norse.torch#
Building blocks for spiking neural networks based on PyTorch.
Containers#
Modules for spiking neural network, adhering to the torch.nn.Module
interface.
Convolutions#
Implements a 2d-convolution applied pointwise in time. |
Encoding#
Stateful encoders as torch modules.
Encodes input currents as fixed (constant) voltage currents, and simulates the spikes that occur during a number of timesteps/iterations (seq_length). |
|
Encodes a tensor of input values, which are assumed to be in the range [0,1] into a tensor of one dimension higher of binary values, which represent input spikes. |
|
Encodes a tensor of input values, which are assumed to be in the range [0,1] into a tensor of binary values, which represent input spikes. |
|
Encodes a set of input values into population codes, such that each singular input value is represented by a list of numbers (typically calculated by a radial basis kernel), whose length is equal to the out_features. |
|
Encodes a tensor of input values, which are assumed to be in the range [-1,1] into a tensor of one dimension higher of values in {-1,0,1}, which represent signed input spikes. |
|
For all neurons, remove all but the first spike. |
|
Encodes an input value by the time the first spike occurs. |
Neuron models#
Integrate-and-fire#
Simple integrators that sums up incoming signals until a threshold.
State of a feed forward integrate-and-fire neuron |
|
Parametrization of an integrate-and-fire neuron |
|
Izhikevich#
State of a Izhikevich neuron |
|
Spiking behavior of a Izhikevich neuron |
|
A neuron layer that wraps a |
|
Module that computes a single Izhikevich neuron-model without recurrence and without time. |
|
A neuron layer that wraps a |
|
Module that computes a single euler-integration step of an Izhikevich neuron-model with recurrence but without time. |
Leaky integrator#
Leaky integrators describe a leaky neuron membrane that integrates incoming currents over time, but never spikes. In other words, the neuron adds up incoming input current, while leaking out some of it in every timestep.
The first equation describes how the membrane voltage (\(v\), across the membrane) changes over time. A constant amount of current is leaked out every timestep (\(v_{\text{leak}}\)), while the current (\(i\)) is added.
The second equation describes how the current flowing into the neuron changes in every timestep.
Notice that both equations are parameterized by the time constant \(\tau\). This constant controls how fast the changes in voltage and current occurs. A large time constant means a small change. In Norse, we call this parameter the inverse to avoid having to recalculate the inverse (\(\tau_{\text{mem_inv}}\) and \(\tau_{\text{syn_inv}}\) respectively). So, for Norse a large inverse time constant means rapid changes while a small inverse time constant means slow changes.
Recall that voltage is the difference in charge between two points (in this case the neuron membrane) and current is the rate of change or the amount of current being added/subtracted at each timestep.
See norse.torch.functional.leaky_integrator
and
Wikipedia.
State of a leaky-integrator |
|
Parameters of a leaky integrator |
|
A neuron layer that wraps a leaky-integrator |
|
Cell for a leaky-integrator without recurrence. |
|
Cell for a leaky-integrator with an additional linear weighting. |
Leaky integrate-and-fire (LIF)#
A very popular neuron model that combines a norse.torch.module.leaky_integrator
with
spike thresholds to produce events (spikes).
See norse.torch.functional.lif
for more information.
A neuron layer that wraps a |
|
Module that computes a single euler-integration step of a leaky integrate-and-fire (LIF) neuron-model without recurrence and without time. |
|
A neuron layer that wraps a |
|
Module that computes a single euler-integration step of a leaky integrate-and-fire (LIF) neuron-model with recurrence but without time. |
LIF, box model#
A simplified version of the popular leaky integrate-and-fire neuron model that combines a norse.torch.functional.leaky_integrator
with spike thresholds to produce events (spikes).
Compared to the norse.torch.functional.lif
modules, this model leaves out the current term, making it computationally simpler but impossible to implement in physical systems because currents cannot “jump” in nature.
It is these sudden current jumps that gives the model its name, because the shift in current is instantaneous and can be drawn as “current boxes”.
Computes a single euler-integration step for a lif neuron-model without current terms. |
LIF, conductance based#
Module that computes a single euler-integration step of a conductance based LIF neuron-model. |
LIF, adaptive exponential#
A neuron layer that wraps a recurrent LIFAdExCell in time such that the layer keeps track of temporal sequences of spikes. After application, the layer returns a tuple containing (spikes from all timesteps, state from the last timestep). |
|
Computes a single euler-integration step of a feed-forward exponential LIF neuron-model without recurrence, adapted from http://www.scholarpedia.org/article/Adaptive_exponential_integrate-and-fire_model. |
|
A neuron layer that wraps a recurrent LIFAdExRecurrentCell in time (with recurrence) such that the layer keeps track of temporal sequences of spikes. After application, the layer returns a tuple containing (spikes from all timesteps, state from the last timestep). |
|
Computes a single of euler-integration step of a recurrent adaptive exponential LIF neuron-model with recurrence, adapted from http://www.scholarpedia.org/article/Adaptive_exponential_integrate-and-fire_model. |
LIF, exponential#
A neuron layer that wraps a |
|
Computes a single euler-integration step of a recurrent exponential LIF neuron-model (without recurrence) adapted from https://neuronaldynamics.epfl.ch/online/Ch5.S2.html. |
|
A neuron layer that wraps a |
|
Computes a single euler-integration step of a recurrent exponential LIFEx neuron-model (with recurrence) adapted from https://neuronaldynamics.epfl.ch/online/Ch5.S2.html. |
LIF, multicompartmental#
Computes a single euler-integration step of a LIF multi-compartment neuron-model. |
LIF, multicompartmental with refraction#
LIF, refractory#
Module that computes a single euler-integration step of a LIF neuron-model with absolute refractory period without recurrence. |
|
Module that computes a single euler-integration step of a LIF neuron-model with absolute refractory period. |
Long short-term memory (LSNN)#
Long-short term memory module, building on the work by [G. Bellec, D. Salaj, A. Subramoney, R. Legenstein, and W. Maass](IGITUGraz/LSNN-official).
See norse.torch.functional.lsnn
for more information.
A Long short-term memory neuron module without recurrence adapted from https://arxiv.org/abs/1803.09574 |
|
Euler integration cell for LIF Neuron with threshold adaptation without recurrence. |
|
A Long short-term memory neuron module wit recurrence adapted from https://arxiv.org/abs/1803.09574 |
|
Module that computes a single euler-integration step of a LSNN neuron-model with recurrence. |
Receptive fields#
These receptive fields are derived from scale-space theory, specifically in the paper Normative theory of visual receptive fields by Lindeberg, 2021.
For use in spiking / binary signals, see the paper on Translation and Scale Invariance for Event-Based Object tracking by Pedersen et al., 2023
Creates a spatial receptive field as 2-dimensional convolutions. |
|
Creates |