norse.torch.module.lif_mc module

class norse.torch.module.lif_mc.LIFMCRecurrentCell(input_size, hidden_size, p=LIFParameters(tau_syn_inv=tensor(200.), tau_mem_inv=tensor(100.), v_leak=tensor(0.), v_th=tensor(1.), v_reset=tensor(0.), method='super', alpha=tensor(100.)), g_coupling=None, **kwargs)[source]

Bases: norse.torch.module.snn.SNNRecurrentCell

Computes a single euler-integration step of a LIF multi-compartment neuron-model.

\[\begin{split}\begin{align*} \dot{v} &= 1/\tau_{\text{mem}} (v_{\text{leak}} \ - g_{\text{coupling}} v + i) \\ \dot{i} &= -1/\tau_{\text{syn}} i \end{align*}\end{split}\]

together with the jump condition

\[z = \Theta(v - v_{\text{th}})\]

and transition equations

\[\begin{split}\begin{align*} v &= (1-z) v + z v_{\text{reset}} \\ i &= i + w_{\text{input}} z_{\text{in}} \\ i &= i + w_{\text{rec}} z_{\text{rec}} \end{align*}\end{split}\]

where \(z_{\text{rec}}\) and \(z_{\text{in}}\) are the recurrent and input spikes respectively.

  • input_size (int) – Size of the input. Also known as the number of input features.

  • hidden_size (int) – Size of the hidden state. Also known as the number of input features.

  • g_coupling (torch.Tensor) – conductances between the neuron compartments

  • p (LIFParameters) – neuron parameters

  • dt (float) – Integration timestep to use

  • autapses (bool) – Allow self-connections in the recurrence? Defaults to False.

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(input_tensor, state=None)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.


Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type

Tuple[Tensor, LIFState]

Return type


training: bool