# Builder¶

The Builder is in charge of mapping (groups of) Nengo operators to the builder objects that know how to translate those operators into a TensorFlow graph.

class nengo_dl.builder.Builder[source]

Manages the operator build classes known to the nengo_dl build process.

classmethod pre_build(ops, signals, rng)[source]

Setup step for build classes, in which they compute any of the values that are constant across simulation timesteps.

Parameters: ops : list of Operator the operator group to build into the model signals : signals.SignalDict mapping from Signal to tf.Tensor (updated by operations) rng : RandomState random number generator instance
classmethod build(ops, signals)[source]

Build the computations implementing a single simulator timestep.

Parameters: ops : list of Operator the operator group to build into the model signals : signals.SignalDict mapping from Signal to tf.Tensor (updated by operations)
classmethod register(nengo_op)[source]

A decorator for adding a class to the build function registry.

Parameters: nengo_op : Operator The operator associated with the build function being decorated.
class nengo_dl.builder.OpBuilder(ops, signals)[source]

The constructor should set up any computations that are fixed for this op (i.e., things that do not need to be recomputed each timestep).

Parameters: ops : list of Operator the operator group to build into the model signals : signals.SignalDict mapping from Signal to tf.Tensor (updated by operations) pass_rng : bool set to True if this build class requires the simulation random number generator to be passed to the constructor
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) 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