norse.torch

Building blocks for spiking neural networks based on PyTorch.

Containers

Lift

Lift applies a given torch.nn.Module over

SequentialState

A sequential model that works like PyTorch’s Sequential with the addition that it handles neuron states.

RegularizationCell

A regularisation cell that accumulates some state (for instance number of spikes) for each forward step, which can later be applied to a loss term.

Encoding

ConstantCurrentLIFEncoder

Encodes input currents as fixed (constant) voltage currents, and simulates the spikes that occur during a number of timesteps/iterations (seq_length).

PoissonEncoder

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.

PoissonEncoderStep

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.

PopulationEncoder

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.

SignedPoissonEncoder

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.

SpikeLatencyEncoder

For all neurons, remove all but the first spike.

SpikeLatencyLIFEncoder

Encodes an input value by the time the first spike occurs.

Convolutions

LConv2d

Implements a 2d-convolution applied pointwise in time.

Neuron models

Izhikevich

IzhikevichState

State of a Izhikevich neuron

IzhikevichSpikingBehavior

Spiking behavior of a Izhikevich neuron

Izhikevich

A neuron layer that wraps a IzhikevichCell 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).

IzhikevichCell

Module that computes a single Izhikevich neuron-model without recurrence and without time.

IzhikevichRecurrent

A neuron layer that wraps a IzhikevichRecurrentCell 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).

IzhikevichRecurrentCell

Module that computes a single euler-integration step of an Izhikevich neuron-model with recurrence but without time.

Leaky integrator

LIState

State of a leaky-integrator

LIParameters

Parameters of a leaky integrator

LI

A neuron layer that wraps a leaky-integrator LICell in time, but without recurrence.

LICell

Cell for a leaky-integrator without recurrence.

LILinearCell

Cell for a leaky-integrator with an additional linear weighting.

Leaky integrate-and-fire (LIF)

LIFParameters

Parametrization of a LIF neuron

LIFState

State of a LIF neuron

LIF

A neuron layer that wraps a LIFCell 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).

LIFCell

Module that computes a single euler-integration step of a leaky integrate-and-fire (LIF) neuron-model without recurrence and without time.

LIFRecurrent

A neuron layer that wraps a LIFRecurrentCell in time such that the layer keeps track of temporal sequences of spikes. After application, the module returns a tuple containing (spikes from all timesteps, state from the last timestep).

LIFRecurrentCell

Module that computes a single euler-integration step of a leaky integrate-and-fire (LIF) neuron-model with recurrence but without time.

LIF, conductance based

CobaLIFCell

Module that computes a single euler-integration step of a conductance based LIF neuron-model.

LIF, adaptive exponential

LIFAdEx

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).

LIFAdExCell

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.

LIFAdExRecurrent

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).

LIFAdExRecurrentCell

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

LIFEx

A neuron layer that wraps a LIFExCell 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).

LIFExCell

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.

LIFExRecurrent

A neuron layer that wraps a LIFExRecurrentCell in time such that the layer keeps track of temporal sequences of spikes. After application, the module returns a tuple containing (spikes from all timesteps, state from the last timestep).

LIFExRecurrentCell

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.

Long short-term memory (LSNN)

LSNN

A Long short-term memory neuron module without recurrence adapted from https://arxiv.org/abs/1803.09574

LSNNCell

Euler integration cell for LIF Neuron with threshold adaptation without recurrence.

LSNNRecurrent

A Long short-term memory neuron module wit recurrence adapted from https://arxiv.org/abs/1803.09574

LSNNRecurrentCell

Module that computes a single euler-integration step of a LSNN neuron-model with recurrence.