Learning rules

Build Nengo learning rules into the TensorFlow graph.

class nengo_dl.learning_rule_builders.SimBCMBuilder(ops, signals)[source]

Build a group of SimBCM operators.

build_step(signals)[source]

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

Parameters:
signals : signals.SignalDict

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

Returns:
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.learning_rule_builders.SimOjaBuilder(ops, signals)[source]

Build a group of SimOja operators.

build_step(signals)[source]

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

Parameters:
signals : signals.SignalDict

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

Returns:
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.learning_rule_builders.SimVojaBuilder(ops, signals)[source]

Build a group of SimVoja operators.

build_step(signals)[source]

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

Parameters:
signals : signals.SignalDict

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

Returns:
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.learning_rule_builders.SimPES(pre_filtered, error, delta, learning_rate, tag=None)[source]

Calculate connection weight change according to the PES rule.

Implements the PES learning rule of the form

\[\Delta \omega_{ij} = \frac{\kappa}{n} e_j a_i\]

where

  • \(\kappa\) is a scalar learning rate,
  • \(n\) is the number of presynaptic neurons
  • \(e_j\) is the error for the jth output dimension, and
  • \(a_i\) is the activity of a presynaptic neuron.
Parameters:
pre_filtered : Signal

The presynaptic activity, \(a_i\).

error : Signal

The error signal, \(e_j\).

delta : Signal

The synaptic weight change to be applied, \(\Delta \omega_{ij}\).

learning_rate : float

The scalar learning rate, \(\kappa\).

tag : str, optional (Default: None)

A label associated with the operator, for debugging purposes.

Notes

  1. sets [delta]
  2. incs []
  3. reads [pre_filtered, error]
  4. updates []
Attributes:
pre_filtered : Signal

The presynaptic activity, \(a_i\).

error : Signal

The error signal, \(e_j\).

delta : Signal

The synaptic weight change to be applied, \(\Delta \omega_{ij}\).

learning_rate : float

The scalar learning rate, \(\kappa\).

tag : str, optional (Default: None)

A label associated with the operator, for debugging purposes.

nengo_dl.learning_rule_builders.build_pes(model, pes, rule)[source]

Builds a .PES object into a model.

Parameters:
model : Model

The model to build into.

pes : PES

Learning rule type to build.

rule : LearningRule

The learning rule object corresponding to the neuron type.

Notes

Does not modify model.params[] and can therefore be called more than once with the same .PES instance.

class nengo_dl.learning_rule_builders.SimPESBuilder(ops, signals)[source]

Build a group of SimPES operators.

build_step(signals)[source]

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

Parameters:
signals : signals.SignalDict

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

Returns:
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