layers#

Parent layers#

StatefulLayer(state_names)

A base class that instantiates buffers/states which update at every time step and provides helper methods that manage those states.

SqueezeMixin()

Utility mixin class that will wrap the __init__ and forward call to flatten the input to and the output from a child class.

Spiking#

All spiking layers are subclasses of StatefulLayer and Squeeze layers additionally inherit from SqueezeMixin.

IAF(spike_threshold, spike_fn, reset_fn, ...)

Integrate and Fire neuron layer that is designed as a special case of LIF with tau_mem=inf.

IAFSqueeze([batch_size, num_timesteps])

IAF layer with 4-dimensional input (Batch*Time, Channel, Height, Width).

IAFRecurrent(rec_connect, spike_threshold, ...)

Integrate and Fire neuron layer with recurrent connections which inherits from LIFRecurrent.

LIF(tau_mem, torch.Tensor], tau_syn, ...)

Leaky Integrate and Fire neuron layer that inherits from StatefulLayer.

LIFSqueeze([batch_size, num_timesteps])

LIF layer with 4-dimensional input (Batch*Time, Channel, Height, Width).

LIFRecurrent(tau_mem, torch.Tensor], ...)

Leaky Integrate and Fire neuron layer with recurrent connections which inherits from LIF.

ALIF(tau_mem, torch.Tensor], tau_adapt, ...)

Adaptive Leaky Integrate and Fire neuron layer that inherits from StatefulLayer.

ALIFRecurrent(tau_mem, torch.Tensor], ...)

Adaptive Leaky Integrate and Fire neuron layer with recurrent connections which inherits from ALIF.

Non-spiking#

These layers are special cases of LIF layers.

ExpLeak(tau_mem[, shape, train_alphas, ...])

Leaky Integrator layer which is a special case of LIF without activation function.

ExpLeakSqueeze([batch_size, num_timesteps])

ExpLeak layer with 4-dimensional input (Batch*Time, Channel, Height, Width).

Pooling#

SpikingMaxPooling2dLayer(pool_size[, ...])

Torch implementation of SpikingMaxPooling.

SumPool2d(kernel_size[, stride, ceil_mode])

Non-spiking sumpooling layer to be used in analogue Torch models.

Conversion from images / analog signals#

Img2SpikeLayer(image_shape[, tw, max_rate, ...])

Layer to convert images to spikes.

Sig2SpikeLayer(channels_in[, tw, ...])

Layer to convert analog Signals to spikes.

Auxiliary#

Cropping2dLayer([cropping])

Crop input image by

Repeat(module)

Utility layer which wraps any nn.Module.

FlattenTime()

Utility layer which always flattens first two dimensions and is a special case of torch.nn.Flatten().

UnflattenTime(batch_size)

Utility layer which always unflattens (expands) the first dimension into two separate ones.

ANN layers#

NeuromorphicReLU([quantize, fanout, ...])

NeuromorphicReLU layer.

QuantizeLayer([quantize])

Layer that quantizes the input, i.e. returns floor(input).