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, op_builds)[source]¶ Setup step for build classes, in which they compute any of the values that are constant across simulation timesteps.
Parameters: - ops : tuple of
Operator
the operator group to build into the model
- signals :
signals.SignalDict
mapping from
Signal
totf.Tensor
(updated by operations)- rng :
RandomState
random number generator instance
- op_builds : dict of {tuple of
Operator
, :class:~`.op_builders.OpBuilder`} pre_build
will populate this dictionary with the OpBuilder objects (which execute the pre-build step in their__init__
)
- ops : tuple of
-
classmethod
build
(ops, signals, op_builds)[source]¶ Build the computations implementing a single simulator timestep.
Parameters: - ops : tuple of
Operator
the operator group to build into the model
- signals :
signals.SignalDict
mapping from
Signal
totf.Tensor
(updated by operations)- op_builds : dict of {tuple of
Operator
, :class:~`.op_builders.OpBuilder`} mapping from operator groups to the pre-built builder objects
- ops : tuple of
-
classmethod
-
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
totf.Tensor
(updated by operations)
Attributes: - 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
totf.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
- signals :
- ops : list of