Note

This documentation is for a development version. Click here for the latest stable release (v0.5.0).

Loihi training

When training models for Loihi using NengoDL, you can improve performance by better matching the chip’s neuron cores using the LoihiLIF and LoihiSpikingRectifiedLinear neuron types. This module, which is automatically used by NengoLoihi, adds builders to NengoDL that allow those neuron types to build and train properly.

Neuron output noise models

class nengo_extras.loihi_training.NeuronOutputNoise[source]

Noise added to the output of a rate neuron.

Often used when training deep networks with rate neurons for final implementation in spiking neurons to simulate the variability caused by spiking.

class nengo_extras.loihi_training.LowpassRCNoise(tau_s)[source]

Noise model combining Lowpass synapse and neuron membrane filters.

Samples “noise” (i.e. variability) from a regular spike train filtered by the following transfer function, where \(\tau_{rc}\) is the membrane time constant and \(\tau_s\) is the synapse time constant:

\[H(s) = [(\tau_s s + 1) (\tau_{rc} s + 1)]^{-1}\]

See [1] for background and derivations.

References

1

E. Hunsberger (2018) “Spiking Deep Neural Networks: Engineered and Biological Approaches to Object Recognition.” PhD thesis. pp. 106–113. (http://compneuro.uwaterloo.ca/publications/hunsberger2018.html)

Attributes
tau_sfloat

Time constant for Lowpass synaptic filter.

class nengo_extras.loihi_training.AlphaRCNoise(tau_s)[source]

Noise model combining Alpha synapse and neuron membrane filters.

Samples “noise” (i.e. variability) from a regular spike train filtered by the following transfer function, where \(\tau_{rc}\) is the membrane time constant and \(\tau_s\) is the synapse time constant:

\[H(s) = [(\tau_s s + 1)^2 (\tau_{rc} s + 1)]^{-1}\]

See [1] for background and derivations.

References

1

E. Hunsberger (2018) “Spiking Deep Neural Networks: Engineered and Biological Approaches to Object Recognition.” PhD thesis. pp. 106–113. (http://compneuro.uwaterloo.ca/publications/hunsberger2018.html)

Attributes
tau_sfloat

Time constant for Alpha synaptic filter.

NengoDL builders

class nengo_extras.loihi_training.NoiseBuilder(ops, noise_models)[source]

Build noise classes in nengo_dl.

Attributes
noise_modelslist of NeuronOutputNoise

The noise models used for each op/signal.

classmethod build(ops)[source]

Create a NoiseBuilder for the provided ops.

classmethod register(noise_builder)[source]

A decorator for adding a class to the list of builders.

Raises a warning if a builder already exists for the class.

Parameters
noise_builderNoiseBuilder

The NoiseBuilder subclass that the decorated class builds.

build_step(period, tau_rc=None)[source]

Generate TensorFlow code to implement these noise models.

Parameters
periodtf.Tensor

The inter-spike periods of the neurons to add noise to.

tau_rctf.Tensor

The membrane time constant of the neurons (used by some noise models).

class nengo_extras.loihi_training.NoNoiseBuilder(ops, noise_models)[source]

nengo_dl builder for if there is no noise model.

build_step(period, tau_rc=None)[source]

Generate TensorFlow code to implement these noise models.

Parameters
periodtf.Tensor

The inter-spike periods of the neurons to add noise to.

tau_rctf.Tensor

The membrane time constant of the neurons (used by some noise models).

class nengo_extras.loihi_training.LowpassRCNoiseBuilder(ops, noise_models)[source]

nengo_dl builder for the LowpassRCNoise model.

build_step(period, tau_rc=None)[source]

Generate TensorFlow code to implement these noise models.

Parameters
periodtf.Tensor

The inter-spike periods of the neurons to add noise to.

tau_rctf.Tensor

The membrane time constant of the neurons (used by some noise models).

class nengo_extras.loihi_training.AlphaRCNoiseBuilder(ops, noise_models)[source]

nengo_dl builder for the AlphaRCNoise model.

build_step(period, tau_rc=None)[source]

Generate TensorFlow code to implement these noise models.

Parameters
periodtf.Tensor

The inter-spike periods of the neurons to add noise to.

tau_rctf.Tensor

The membrane time constant of the neurons (used by some noise models).

class nengo_extras.loihi_training.LoihiLIFBuilder(ops)[source]

nengo_dl builder for the LoihiLIF neuron type.

Attributes
spike_noiseNoiseBuilder

Generator for any output noise associated with these neurons.

class nengo_extras.loihi_training.LoihiSpikingRectifiedLinearBuilder[source]

nengo_dl builder for the LoihiSpikingRectifiedLinear neuron type.