hxtorch.spiking.functional.lif

Leaky-integrate and fire neurons

Classes

Unterjubel(*args, **kwargs)

Unterjubel hardware observables to allow correct gradient flow

Functions

hxtorch.spiking.functional.lif.exp_cuba_lif_integration(input: torch.Tensor, *, leak: torch.Tensor, reset: torch.Tensor, threshold: torch.Tensor, tau_syn_exp: torch.Tensor, tau_mem_exp: torch.Tensor, method: torch.Tensor, alpha: torch.Tensor, hw_data: Optional[torch.Tensor, None] = None)Tuple[torch.Tensor, ]
hxtorch.spiking.functional.lif.refractory_update(z: torch.Tensor, v: torch.Tensor, ref_state: torch._VariableFunctionsClass.tensor, spikes_hw: torch.Tensor, membrane_hw: torch.Tensor, *, reset: torch.Tensor, refractory_time: torch.Tensor, dt: float)Tuple[torch.Tensor, ]

Update neuron membrane and spikes to account for refractory period. This implemention is widly adopted from: https://github.com/norse/norse/blob/main/norse/torch/functional/lif_refrac.py

Parameters
  • z – The spike tensor at time step t.

  • v – The membrane tensor at time step t.

  • ref_state – The refractory state holding the number of time steps the neurons has to remain in the refractory period.

  • spikes_hw – The hardware spikes corresponding to the current time step. In case this is None, no HW spikes will be injected.

  • membrnae_hw – The hardware CADC traces corresponding to the current time step. In case this is None, no HW CADC values will be injected.

  • reset – The reset voltage as torch.Tensor.

  • refractory_time – The refractory time constant as torch.Tensor.

  • dt – Integration step width.

Returns

Returns a tuple (z, v, ref_state) holding the tensors of time step t.

hxtorch.spiking.functional.lif.spiking_threshold(input: torch.Tensor, method: str, alpha: float)torch.Tensor

Selection of the used threshold function. :param input: Input tensor to threshold function. :param method: The string indicator of the the threshold function.

Currently supported: ‘super_spike’.

Parameters

alpha – Parameter controlling the slope of the surrogate derivative in case of ‘superspike’.

Returns

Returns the tensor of the threshold function.

hxtorch.spiking.functional.lif.warn(message, category=None, stacklevel=1, source=None)

Issue a warning, or maybe ignore it or raise an exception.