Neuron types

Build Nengo neuron types into the TensorFlow graph.

class nengo_dl.neurons.SoftLIFRate(sigma=1.0, **lif_args)[source]

LIF neuron with smoothing around the firing threshold.

This is a rate version of the LIF neuron whose tuning curve has a continuous first derivative, due to the smoothing around the firing threshold. It can be used as a substitute for LIF neurons in deep networks during training, and then replaced with LIF neurons when running the network [1].

sigma : float

Amount of smoothing around the firing threshold. Larger values mean more smoothing.

tau_rc : float

Membrane RC time constant, in seconds. Affects how quickly the membrane voltage decays to zero in the absence of input (larger = slower decay).

tau_ref : float

Absolute refractory period, in seconds. This is how long the membrane voltage is held at zero after a spike.


Adapted from


[1](1, 2) E. Hunsberger & C. Eliasmith (2015). Spiking Deep Networks with LIF Neurons. arXiv Preprint, 1510.
rates(x, gain, bias)[source]

Always use LIFRate to determine rates.

step_math(dt, J, output)[source]

Compute rates in Hz for input current (incl. bias)

class nengo_dl.neurons.SimNeuronsBuilder(ops, signals)[source]

Builds a group of SimNeurons operators.

Calls the appropriate sub-build class for the different neuron types.

TF_NEURON_IMPL : list of NeuronType

the neuron types that have a custom implementation


This function builds whatever computations need to be executed in each simulation timestep.

signals : signals.SignalDict

mapping from Signal to tf.Tensor (updated by operations)

list of ``tf.Tensor``, optional

if not None, the returned tensors correspond to outputs with possible side-effects, i.e. computations that need to be executed in the tensorflow graph even if their output doesn’t appear to be used

class nengo_dl.neurons.GenericNeuronBuilder(ops, signals)[source]

Builds all neuron types for which there is no custom Tensorflow implementation.


These will be executed as native Python functions, requiring execution to move in and out of Tensorflow. This can significantly slow down the simulation, so any performance-critical neuron models should consider adding a custom Tensorflow implementation for their neuron type instead.

class nengo_dl.neurons.RectifiedLinearBuilder(ops, signals)[source]

Build a group of RectifiedLinear neuron operators.

class nengo_dl.neurons.SigmoidBuilder(ops, signals)[source]

Build a group of Sigmoid neuron operators.

class nengo_dl.neurons.LIFRateBuilder(ops, signals)[source]

Build a group of LIFRate neuron operators.

class nengo_dl.neurons.LIFBuilder(ops, signals)[source]

Build a group of LIF neuron operators.

class nengo_dl.neurons.SoftLIFRateBuilder(ops, signals)[source]