Package: nengo-dl
Deep learning integration for NengoNengoDL is a simulator forNengomodels.
That means it takes a Nengo network as input, and allows the user to simulate
that network using some underlying computational framework (in this case,TensorFlow).In practice, what that means is that the code for constructing a Nengo model
is exactly the same as it would be for the standard Nengo simulator.  All that
changes is that we use a different Simulator class to execute the
model.For example:importnengoimportnengo_dlimportnumpyasnpwithnengo.Network()asnet:inp=nengo.Node(output=np.sin)ens=nengo.Ensemble(50,1,neuron_type=nengo.LIF())nengo.Connection(inp,ens,synapse=0.1)p=nengo.Probe(ens)withnengo_dl.Simulator(net)assim:# this is the only line that changessim.run(1.0)print(sim.data[p])However, NengoDL is not simply a duplicate of the Nengo simulator.  It also
adds a number of unique features, such as:optimizing the parameters of a model through deep learning
training methods (using the Keras API)faster simulation speed, on both CPU and GPUautomatic conversion from Keras models to Nengo networksinserting  TensorFlow code (individual functions or whole
network architectures) directly into a Nengo modelIf you are interested in NengoDL you may also be interested inKerasSpiking, a
companion project to NengoDL that has a more minimal feature set but integrates
even more transparently with the Keras API. Seethis pagefor a more
detailed comparison between the two projects.DocumentationCheck out thedocumentationforInstallation instructionsDetails on the unique features of NengoDLTutorial for new users with a TensorFlow backgroundTutorial for new users with a Nengo backgroundMore in-depth examplesAPI referenceRelease history3.6.0 (January 26, 2023)Compatible with Nengo 3.0 - 3.2Compatible with TensorFlow 2.3 - 2.11AddedIncludedtensorflow-macosin the alternative tensorflow package names checked
during installation. (#228)Added support forgroupsparameter to ConvertConv. (#223)ChangedPinned TensorFlow version to <2.11 on Windows. As of 2.11 the TensorFlow package for
Windows is maintained by a third party (Intel), and there are currently bugs in that
package affecting functionality that is required by NengoDL. (#229)RemovedRemoved support for “graph mode” (i.e., running withtf.compat.v1.disable_eager_execution()). TensorFlow is no longer supporting
this functionality, and it is increasingly buggy. Graph mode may still be faster for
some models; if you need this functionality, try using a previous version of NengoDL.
(#229)Dropped support for TensorFlow 2.2. The minimum supported version is now 2.3.4
(earlier 2.3.x versions should work as well, but TensorFlow may install an
incompatibleprotobufversion that the user will need to manually correct).
(#228)3.5.0 (May 18, 2022)Compatible with Nengo 3.0 - 3.2Compatible with TensorFlow 2.2 - 2.9ChangedDropped support for Python 3.6 and added support for 3.9 and 3.10. (#224)3.4.4 (February 10, 2022)Compatible with Nengo 3.0 - 3.2Compatible with TensorFlow 2.2 - 2.8AddedAdded support fornengo.transforms.ConvolutionTranspose. (#183)3.4.3 (November 9, 2021)Compatible with Nengo 3.0.0 - 3.1.0Compatible with TensorFlow 2.2.0 - 2.7.0AddedAdded support for TensorFlow 2.7.0. (#218)ChangedIncreased minimumkeras-spikingversion to 0.3.0. (#219)3.4.2 (August 12, 2021)Compatible with Nengo 3.0.0 - 3.1.0Compatible with TensorFlow 2.2.0 - 2.6.0AddedAdded support for TensorFlow 2.6.0. (#216)3.4.1 (May 28, 2021)Compatible with Nengo 3.0.0 - 3.1.0Compatible with TensorFlow 2.2.0 - 2.5.0AddedAdded support for TensorFlow 2.5.0. (#212)FixedA more informative error message will be raised if a custom neuron build function
returns the wrong number of values. (#199)RemovedDropped support for Python 3.5 (which reached its end of life in September 2020).
(#184)3.4.0 (November 26, 2020)Compatible with Nengo 3.0.0 - 3.1.0Compatible with TensorFlow 2.2.0 - 2.4.0AddedAdded support forKerasSpikinglayers in
the Converter. (#182)Added support fortf.keras.layers.TimeDistributedin the Converter. (#182)Added support for TensorFlow 2.4. (#185)Added support for Nengo 3.1. (#187)ChangedMinor improvements to build speed by building constants outside of TensorFlow.
(#173)Support for PES implementation changes in Nengo core (see#1627and#1640). (#181)FixedGlobal default Keras dtype will now be reset correctly when an exception occurs
in a Simulator method outside thewith Simulatorcontext. (#173)Support new LinearFilter step type introduced in Nengo core (see#1629). (#173)Fixed a bug when slicing multi-dimensional Signals (e.g. Ensemble encoders).
(#181)Fixed a bug when loading weights saved in a different Python version. (#187)3.3.0 (August 14, 2020)Compatible with Nengo 3.0.0Compatible with TensorFlow 2.2.0 - 2.3.0AddedAdded support for new Nengo coreNeuronTypestate implementation. (#159)Compatible with TensorFlow 2.3.0. (#159)Added support fornengo.Tanh,nengo.RegularSpiking,nengo.StochasticSpiking, andnengo.PoissonSpikingneuron types. (#159)Addednengo_dl.configure_settings(learning_phase=True/False)configuration
option. This mimics the previous behaviour oftf.keras.backend.learning_phase_scope(which was deprecated by TensorFlow). That
is, if you would like to override the default behaviour so that, e.g.,sim.predictruns in training mode, setnengo_dl.configure_settings(learning_phase=True).
(#163)ChangedSimulator.evaluateno longer prints any information to stdout in TensorFlow
2.2 in graph mode (due to a TensorFlow issue, seehttps://github.com/tensorflow/tensorflow/issues/39456). Loss/metric values
will still be returned from the function as normal. (#153)A warning will now be raised if activation types are passed toConverter.swap_activationsthat aren’t actually in the model. (#168)Updated TensorFlow installation instruction in documentation. (#170)NengoDL will now use TensorFlow’s eager mode by default. The previous graph-mode
behaviour can be restored by callingtf.compat.v1.disable_eager_execution(), but
we cannot guarantee that that behaviour will be supported in the future. (#163)NengoDL will now use TensorFlow’s “control flow v2” by default. The previous
behaviour can be restored by callingtf.compat.v1.disable_control_flow_v2(), but
we cannot guarantee that that behaviour will be supported in the future. (#163)NengoDL will now default to allowing TensorFlow’s “soft placement” logic, meaning
that even if you specify an explicit device like"/gpu:0", TensorFlow may not
allocate an op to that device if there isn’t a compatible implementation available.
The previous behaviour can be restored by callingtf.config.set_soft_device_placement(False). (#163)Internal NengoDLOpBuilderclasses now separate the “pre build” stage fromOpBuilder.__init__(so that the sameOpBuilderclass can be re-used across
multiplecalls, rather than instantiating a newOpBuildereach time). Note
that this has no impact on front-end users, this is
only relevant to anyone that has implemented a custom build class. The
logic that would previously have gone inOpBuilder.__init__should now go inOpBuilder.build_pre. In addition, theopsargument has been removed
fromOpBuilder.build_pre; that will be passed toOpBuilder.__init__(
and will be available inbuild_preasself.ops). Similarly, theopsandconfigargument have been removed frombuild_post, and can instead be
accessed throughself.ops/config. (#163)Minimum TensorFlow version is now 2.2.0. (#163)FixedSupport Sparse transforms inSimulator.get_nengo_params. (#149)Fixed bug in TensorGraph log message when logging was enabled. (#151)Updated the KerasWrapper class in thetensorflow-modelsexample to fix
a compatibility issue in TensorFlow 2.2. (#153)Handle Nodes that are not connected to anything else, but are probed (this only
occurs in Nengo>=3.1.0). (#159)More robust support for converting nested Keras models in TensorFlow 2.3. (#161)Fix bug when probing slices of certain probeable attributes (those that are
directly targeting a Signal in the model). (#164)RemovedRemovednengo_dl.utils.print_op(usetf.printinstead). (#163)3.2.0 (April 2, 2020)Compatible with Nengo 3.0.0Compatible with TensorFlow 2.0.0 - 2.2.0AddedAddednengo_dl.LeakyReLUandnengo_dl.SpikingLeakyReLUneuron models.
(#126)Added support for leaky ReLU Keras layers tonengo_dl.Converter. (#126)Added a newremove_reset_incsgraph simplification step. (#129)Added support for UpSampling layers tonengo_dl.Converter. (#130)Added tolerance parameters tonengo_dl.Converter.verify. (#130)Addedscale_firing_ratesoption tonengo_dl.Converter. (#134)AddedConverter.layersattribute which will map Keras layers/tensors to
the converted Nengo objects, to make it easier to access converted components.
(#134)Compatible with TensorFlow 2.2.0. (#140)Added a newsynapseargument to the Converter, which can be used to automatically
add synaptic filters on the output of neural layers during the conversion process.
(#141)Added anew exampledemonstrating how to use the NengoDL Converter to convert a Keras model to a spiking
Nengo network. (#141)ChangedRe-enabled theremove_constant_copiesgraph simplification by default. (#129)Reduced the amount of state that needs to be stored in the simulation. (#129)Added more information to the error message when loading saved parameters that
don’t match the current model. (#129)More efficient implementation of convolutional biases in the Converter. (#130)Saved simulator state will no longer be included inSimulator.keras_model.weights.
This means thatSimulator.keras_model.save/load_weightswill not include the
saved simulator state, making it easier to reuse weights between models (as long as
the models have the same weights, they do not need to have the same state variables).Simulator.save/load_params(...,include_state=True)can be used to explicitly
save the simulator state, if desired. (#140)Model parameters (e.g., connection weights) that are not trainable (because they’ve
been marked non-trainable by user or targeted by an online learning rule) will now
be treated separately from simulator state. For example,Simulator.save_params(...,include_state=False)will still include those
parameters, and the results of any online learning will persist between calls even
withstateful=False. (#140)Addedinclude_probes,include_trainable, andinclude_processesarguments
toSimulator.resetto provide more fine-grained control over Simulator
resetting. This replicates the previous functionality inSimulator.soft_reset.
(#139)More informative error messages when accessing invalid Simulator functionality after
the Simulator has been closed. (#139)A warning is now raised when the number of input data items passed to the simulator
does not match the number of input nodes, to help avoid unintentionally passing
data to the wrong input node. This warning can be avoided by passing data for
all nodes, or using the dictionary input style if you want to only pass data for
a specific node. (#139)Dictionaries returned bysim.predict/evaluatewill now be ordered. (#141)FixedFixed bug in error message when passing data with batch size less than Simulator
minibatch size. (#139)More informative error message whenvalidation_splitdoes not result in batch
sizes evenly divisible by minibatch size. (#139)Addedtensorflow-cpudistributions to installation checks (so Nengo DL will
not attempt to reinstall TensorFlow iftensorflow-cpuis already installed).
(#142)Fixed bug when applying the Converter to Keras models that re-use intermediate
layers as output layers. (#137)Fixed bug in conversion of Keras Dense layers with non-native activation functions.
(#144)DeprecatedRenamedSimulator.save/load_paramsinclude_non_trainableparameter toinclude_state. (#140)Simulator.soft_resethas been deprecated. UseSimulator.reset(include_probes=False, include_trainable=False, include_processes=False)instead. (#139)3.1.0 (March 4, 2020)Compatible with Nengo 3.0.0Compatible with TensorFlow 2.0.0 - 2.1.0AddedAddedinference_only=Trueoption to the Converter, which will allow some
Layers/parameters that cannot be fully converted to native Nengo objects to be
converted in a way that only matches the inference behaviour of the source Keras model
(not the training behaviour). (#119)ChangedImproved build time of networks containing lots ofTensorNodes. (#119)Improved memory usage of build process. (#119)Saved simulation state may now be placed on GPU (this should improve the speed of
state updates, but may slightly increase GPU memory usage). (#119)Changed Converterfreeze_batchnorm=Trueoption toinference_only=True(effect of the parameter is the same on BatchNormalization layers, but also has
broader effects). (#119)The precision of the Nengo core build process will now be set based on thenengo_dl.configure_settings(dtype=...)config option. Note that this will
override the default precision set innengo.rc. (#119)Minimum Numpy version is now 1.16.0 (required by TensorFlow). (#119)Added support for the newtransform=Nonedefault in Nengo connections
(seeNengo#1591). Note that this may change the number of trainable
parameters in a network as the scalar defaulttransform=1weights on
non-Ensemble connections will no longer be present. (#128)FixedProvide a more informative error message if Layershape_in/shape_outcontains
undefined (None) elements. (#119)Fixed bug inConverterwhen source model contains duplicate nodes. (#119)Fixed bug inConverterforConcatenatelayers withaxis != 1. (#119)Fixed bug inConverterfor models containing passthroughInputlayers inside
submodels. (#119)Keras Layers inside TensorNodes will be called with thetrainingargument set
correctly (previously it was always set to the default value). (#119)Fixed compatibility withprogressbar2version 3.50.0. (#136)3.0.0 (December 17, 2019)Compatible with Nengo 3.0.0Compatible with TensorFlow 2.0.0There are a lot ofbreaking changesin NengoDL 3.0. See themigration guidefor all the
details.AddedKerasLayerclasses can now be used withnengo_dl.Layer/tensor_layer.TensorGraphcan now be used as a KerasLayer.AddedSimulator.predict/evaluate/fitfunctions, which
implement the KerasModel API.Added a warning that changing the TensorFlow seed (e.g. onSimulator.reset) will
not affect any existing TensorFlow operations (this was always true in TensorFlow,
the warning is just to help avoid confusion).AddedTensorGraph.build_inputs, which will return a set of KerasInputlayers
that can be used as input to the TensorGraph layer itself.Addednengo_dl.callbacks.TensorBoard. This is identical totf.keras.callbacks.TensorBoard, except it will also perform profiling during
inference (rather than only during training).Addedstatefuloption toSimulator.runwhich can be set to False to avoid
updating the saved simulation state at the end of a run.Addednengo_dl.configure_settings(stateful=False)option to avoid building the
parts of the model responsible for preserving state between executions (this will
override anystateful=Truearguments in individual functions).Addednengo_dl.configure_settings(use_loop=False)option to avoid building the
simulation inside a symbolic TensorFlow loop. This may improve simulation speed,
but the simulation can only run for exactlyunroll_simulationtimesteps.NengoDL now requiresjinja2(used to template some of the docstrings).Added aninputsargument toSimulator.check_gradients, which can be used to
control the initial value of input Nodes during the gradient calculations.Addednengo_dl.Converterfor automatically converting Keras models to native
Nengo networks.  Seethe documentationfor more details.AddedLegendre Memory Unit RNN example.ChangedMinimum TensorFlow version is now 2.0.0.Simulator.save/load_paramsnow uses a singleinclude_non_trainable=True/False(equivalent to the previousinclude_local). Trainable parameters will always be saved, so theinclude_globalargument is removed.Standardized all signals/operations in a simulation to be batch-first.Thedtype optionis now specified
as a string (e.g."float32"rather thantf.float32).If the requested number of simulation steps is not evenly divisible bySimulator.unroll_simulationthen probe values andsim.time/n_stepswill be
updated based on the number of steps actually run (rather than the requested
number of steps).  Note that these extra steps were also run previously, but their
results were hidden from the user.RenamedTensorGraph.input_phtoTensorGraph.node_inputs.Simulator.time/n_stepsare now read-only.Simulator.n_steps/timeare now managed as part of the op graph, rather than
manually in the Simulator.Renamednengo_dl.objectivestonengo_dl.losses(to align withtf.losses).nengo_dl.objectives.Regularizenow takes two arguments (y_trueandy_pred)
in order to be compatible with thetf.losses.LossAPI (y_trueis ignored).Theremove_constant_copiessimplification step is now disabled by default.
In certain situations this could be an unsafe manipulation (specifically,
when usingSimulator.save/load_paramsit could change which parameters are saved).
It can be manually re-enabled through thesimplificationsconfiguration option.Simulator.check_gradientsnow only accepts an optional list of Probes (no longer
accepts arbitrary Tensors).Eager execution is no longer disabled on import (it is still disabled within the
Simulator context, for performance reasons; seehttps://github.com/tensorflow/tensorflow/issues/33052).nengo_dl.tensor_layer(x, func,...)now passes any extra kwargs to thenengo_dl.TensorNodeconstructor (rather than tofunc). If you need to pass
information tofuncconsider using partial functions (e.g.tensor_layer(functools.partial(x, func, arg=5),...)or a callable class
(e.g.,tensor_layer(x, MyFunc(arg=5),...)). When using Keras Layers withnengo_dl.tensor_layer, a fully instantiated Layer
object should be passed rather than a Layer class (e.g., usetensor_layer(x, tf.keras.layers.Dense(units=10),...)instead oftensor_layer(x, tf.keras.layers.Dense, units=10)).benchmarks.run_profilenow uses the TensorBoard format when profiling,
seethe documentationfor
instructions on how to view this information (the information is the same, it is
just accessed through TensorBoard rather than requiring that it be loaded directly
in a Chrome browser).nengo_dl.TensorNodenow takesshape_inandshape_outarguments (which
specify a possibly multidimensional shape), rather
than the scalarsize_inandsize_out.TensorNodefunctions no longer use thepre_build/post_buildfunctionality.
If you need to implement more complex behaviour in a TensorNode, use a
custom Keras Layer subclass instead.  For example, TensorNodes Layers can create new
parameter Variables inside the Layerbuildmethod.TensorNodenow has an optionalpass_timeparameter which can be set toFalseto disable passing the current simulation time to the TensorNode function.Addednengo_dl.Layer. Similar to the oldnengo_dl.tensor_layer, this is a
wrapper for constructing TensorNodes, but it mimics the newtf.keras.layers.LayerAPI rather than the oldtf.layers.TensorFlow’s “control flow v2” is disabled on import, for performance reasons; seehttps://github.com/tensorflow/tensorflow/issues/33052.Renamednengo_dl.objectives.msetonengo_dl.losses.nan_mse(to emphasize
the special logic it provides fornantargets).Connections created bynengo_dl.Layer/tensor_layerwill be marked as
non-trainable by default.Updated all documentation and examples for the new syntax (in particular, see the
updatedComing from TensorFlowtutorial andTensorFlow/Keras integrationexample, and the
newTips and trickspage).The training/inference build logic (e.g., swapping spiking neurons with rate
implementations) can be overridden by setting the global Keras learning phase
(tf.keras.backend.set_learning_phase) before the Simulator is constructed.Increased minimum Nengo core version to 3.0.0.Reduced size of TensorFlow constants created by Reset ops.DotInc operators with different signal sizes will no longer be merged (these
merged operators had to use a less efficient sparse matrix multiplication, and in
general this cost outweighed the benefit of merging).Trainability can now be configured in the config of subnetworks. This replaces
the ability to mark Networks as (non)trainable. See theupdated documentationfor details.Training/evaluation target data can now have a different number of timesteps than
input data (as long as it aligns with the number of timesteps expected by the
loss function).Whether or not to display progress bars inSimulator.runandSimulator.run_stepsnow defaults to the value ofSimulator(...,progress_bar=x).FixedFixed bug due to non-determinism of Process state ordering in Python 3.5.Nested Keras layers passed to TensorNode will be rebuilt correctly if necessary.Deprecatednengo_dl.tensor_layerhas been deprecated. Usenengo_dl.Layerinstead;tensor_layer(x, func, **kwargs)is equivalent toLayer(func)(x,**kwargs).RemovedRemoved thesession_configconfiguration
option. Use theupdated TensorFlow config systeminstead.Removed the deprecatednengo_dl.Simulator(...,dtype=...)argument. Usenengo_dl.configure_settings(dtype=...)instead.Removed the deprecatedSimulator.run(...,input_feeds=...)argument. UseSimulator.run(...,data=...)instead.Removed theSimulator.sessattribute (Sessions are no longer used in
TensorFlow 2.0).  The underlying Keras model (Simulator.keras_model) should be
used as the entrypoint into the engine underlying a Simulator instead.Removed theSimulator.lossfunction (useSimulator.compileandSimulator.evaluateto compute loss values instead).Removed theSimulator.trainfunction (useSimulator.compileandSimulator.fitto optimize a network instead).Removed thenengo_dl.objectives.Regularize(weight=x,...)argument. Use theSimulator.compile(loss_weights=...)functionality instead.Removed theSimulator.run(...,extra_feeds=...)argument. TensorFlow 2.0 no longer
uses the Session/feed execution model.RemovedSimulator.run_batch. This functionality is now managed by the underlyingSimulator.keras_model.RemovedTensorGraph.training_step. The training step is now managed by Keras.RemovedTensorGraph.build_outputsandTensorGraph.build_optimizer_func.
Building loss functions/optimizers is now managed by Keras.Removednengo_dl.utils.find_non_differentiable(this no longer works in TF2.0’s
eager mode).RemovedSimulator(...,tensorboard=...)argument. Use the Keras TensorBoard
callback approach for TensorBoard logging instead (seetf.keras.callbacks.TensorBoardornengo_dl.callbacks.NengoSummaries).NengoDL will no longer monkeypatch fix thetf.dynamic_stitchgradients on import.
The gradients are still incorrect (seehttps://github.com/tensorflow/tensorflow/issues/7397), but we no longer use this
operation within NengoDL so we leave it up to the user to fix it in their own code
if needed.Removedbenchmarks.matmul_vs_reduce. We use matmul for everything now, so this
comparison is no longer necessary.Removedutils.minibatch_generator(training/inference loops are now managed
by Keras).2.2.2 (November 20, 2019)Compatible with Nengo 2.8.0 - 3.0.0Compatible with TensorFlow 1.4.0 - 2.0.0FixedCompatibility with Nengo 3.0 release2.2.1 (October 2, 2019)Compatible with Nengo 2.8.0Compatible with TensorFlow 1.4.0 - 2.0.0ChangedUpdate testing framework to use new nengo pytest ecosystem (pytest-rng,pytest-allclose, andpytest-nengo)Disable TensorFlow 2.0 behaviour (e.g. control flow v2) by default.  This will be
re-enabled when full TensorFlow 2.0 support is added.FixedFixedtensorflow-gpuinstallation check in pep517-style isolated build
environments.2.2.0 (July 24, 2019)Compatible with Nengo 2.8.0Compatible with TensorFlow 1.4.0 - 2.0.0AddedAdded anew exampledemonstrating how to integrate a Keras model with NengoDL (thanks to new
contributor@NickleDave).Added support for TensorFlow 2.0 (pre-release).Added support for sparse transforms
(seehttps://github.com/nengo/nengo/pull/1532).Added support for stateful Processes
(seehttps://github.com/nengo/nengo/pull/1387).ChangedThe default session will now be set to the NengoDL session before calling
TensorNodes’post_buildfunction.Renamed the pytestunroll_simulationargument tounroll-simulation.Switched to nengo-bones templating system for TravisCI config/scripts.NengoDL will disable eager execution on import (and will probably not
work properly if it is manually re-enabled).Increased minimum numpy version to 1.14.5 (required by TensorFlow 1.14).Minimum Nengo version is now 2.8.0.Update LinearFilter synapse implementation to match recent changes in
Nengo core (seehttps://github.com/nengo/nengo/pull/1535).FixedFixed TensorFlow seeding so that randomness can be reliably controlled by
setting the Simulator seed.Improved robustness oftensorflow-gpuinstallation check (in particular,
it will now correctly detect GPU dists installed throughconda).Fixed inspection ofTensorNode.tensor_funcarguments for partial
functions.Simulator seed will now be deterministic for a given top-level Network seed.Raise a more informative error if user attempts to pickle a Simulator
(this is not possible to do with TensorFlow sessions; seethe documentationfor other methods of saving/loading a NengoDL model).RemovedNengoDL no longer supports Python 3.4 (official support for 3.4 ended in
March 2019).2.1.1 (January 11, 2019)AddedAddednengo_dl.objas a shortcut alias fornengo_dl.objectives.Added tutorial forNengo users coming to NengoDLAdded tutorial forTensorFlow users coming to NengoDLChangedIncreased minimumprogressbar2version to 3.39.0.We now only providesdistreleases, notbdist_wheel. Due to the way
the TensorFlow packages are organized,bdist_wheelforces any existing
TensorFlow installations (e.g.tensorflow-gpuortf-nightly)
to be overwritten bytensorflow, which we don’t want to do.RemovedRemoved thenef-inittutorial (replaced by the newfrom-nengotutorial).2.1.0 (December 5, 2018)AddedAdded a built-in objective to assist in applying regularization during
training.Addedkeep_history config option, which can be set
toFalseon Probes if only the data from the most recent simulation step
is desired (as opposed to the default behaviour of keeping the data from
all steps).ChangedMovedutils.msetoobjectives.mse.sim.losswill now applynengo_dl.objectives.mseto all probes indataif no explicitobjectiveis given (mirroring the default
behaviour insim.train).The Spaun benchmark network will now be installed through pip rather than
manually cloning and importing the repo.FixedFixed objective argument parsing if objective is a callable class or method.Fixed bug insim.train1-step synapse warning when explicitly specifyingn_steps(rather than passing indata).DeprecatedPassing"mse"as the objective insim.train/sim.lossis no longer
supported.  Use the functionnengo_dl.objectives.mseinstead.2.0.0 (November 23, 2018)Breaking API changessim.trainandsim.lossnow accept a singledataargument, which
combines the previousinputsandtargetsarguments. For example,sim.train({my_node:x},{my_probe:y},...)is now equivalent tosim.train({my_node:x,my_probe:y},...)The motivation for this change is that not all objective functions require
target values. Switching to the more genericdataargument simplifies
the API and makes it more flexible, allowing users to specify whatever
training/loss data is actually required.Theobjectiveargument insim.train/sim.lossis now always
specified as a dictionary mapping probes to objective functions.  Note that
this was available but optional previously; it was also possible to pass
a single value for the objective function, which would be applied to all
probes intargets.  The latter is no longer supported.  For example,sim.train(...,objective="mse")must now be explicitly specified assim.train(...,objective={my_probe:"mse"})The motivation for this change is that, especially with the other new
features introduced in the 2.0 update, there were a lot of different ways to
specify theobjectiveargument.  This made it somewhat unclear how
exactly this argument worked, and the automatic “broadcasting” was also
ambiguous (e.g., should the single objective be applied to each probe
individually, or to all of them together?).  Making the argument explicit
helps clarify the mental model.AddedAn integer number of steps can now be passed for thesim.loss/sim.traindata argument, if no input/target data is
required.Theobjectivedict insim.train/sim.losscan now contain
tuples of probes as the keys, in which case the objective function will be
called with a corresponding tuple of probe/target values as each argument.Added thesim.run_batchfunction.  This exposes all the functionality
that thesim.run/sim.train/sim.lossfunctions are based on,
allowing advanced users full control over how to run a NengoDL simulation.Added option to disable progress bar insim.trainandsim.loss.Addedtrainingargument tosim.lossto control whether the loss
is evaluated in training or inference mode.Added support for the new NengoTransformAPI (seehttps://github.com/nengo/nengo/pull/1481).ChangedCustom objective functions passed tosim.train/sim.losscan now
accept a single argument (my_objective(outputs): ...instead ofmy_objective(outputs, targets): ...) if no target values are required.utils.minibatch_generatornow accepts a singledataargument rather
thaninputsandtargets(see discussion in “Breaking API changes”).sim.training_stepis now the same astf.train.get_or_create_global_step().Switched documentation to newnengo-sphinx-theme.Reorganized documentation into “User guide” and “API reference” sections.Improve build speed of models with large constants
(#69)Moved op-specific merge logic into theOpBuilderclasses.FixedEnsure that training step is always updated before TensorBoard events are
added (previously it could update before or after depending on the platform).DeprecatedThesim.runinput_feedsargument has been renamed todata(for
consistency with other simulator functions).RemovedNengoDL no longer supports Python 2 (seehttps://python3statement.org/for
more information)1.2.1 (November 2, 2018)AddedAdded a warning if users run one-timestep training with a network containing
synaptic filters.ChangedTest Simulator parameters are now controlled through pytest arguments,
rather than environment variables.Disable INFO-level TensorFlow logging (from C side) on import.  Added a
NengoDL log message indicating the device the simulation will run on, as
a more concise replacement.Boolean signals are now supported
(#61)FixedAvoid backpropagating NaN gradients from spiking neurons.Fixed an error that was thrown when callingget_tensoron aSignalthat was first initialized inside the Simulation while loop
(#56)Allow TensorNodes to run in Nengo GUI.Avoid bug in TensorFlow 1.11.0 that prevents certain models from
running (seehttps://github.com/tensorflow/tensorflow/issues/23383). Note
that this doesn’t prevent this from occurring in user models, as we cannot
control the model structure there. If your model hangs indefinitely when
you callsim.train, try downgrading to TensorFlow 1.10.0.Ensure thatsim.training_stepis always updated after the optimization
step (in certain race conditions it would sometimes update part-way through
the optimization step).1.2.0 (September 5, 2018)AddedNengoDL will now automatically use a rate-based approximation to compute the
gradient for spiking neuron types, if one is known (no more need to manually
swap neuron types for training and inference).Addednengo_dl.configure_settings(inference_only=True)option, which will
build the network in inference-only mode.  This will slightly improve the
inference speed of the simulation, but the network will not be trainable.Addednengo_dl.configure_settings(lif_smoothing=x)option, which will
control how much smoothing is applied to the LIF function during gradient
calculations (if any).Addeddocumentationon the
various NengoDL config options.Added better validation for TensorNode output whensize_out != None(#51)ChangedMore informative error message if the user tries to pass target values for
a probe that isn’t used in the objective function.Switched to ADD_N gradient accumulation (from TREE); this will increase
the memory usage during training, but improve performance.Revert toTimelineprofiling method.tf.profilercan produce
incorrect output, and isn’t maintained any more
(https://github.com/tensorflow/tensorflow/issues/15214#issuecomment-382442357)Reduce memory usage during training by caching temporary variables used
when computingScatterUpdategradient.Increase minimum TensorFlow version to 1.4.0.Increased minimum NumPy version to 1.12.1 (required by TensorFlow)Sort write signals as well as reads during graph optimization (encourages
tighter partitioning, which can improve training/inference speed).Movedconfigure_settingsfromutils.pytoconfig.py.FixedFixed a bug wherenengo_dl.dists.VarianceScaling(...,distribution="normal")did not
respect the seed if one was given.DeprecatedTheSimulator(dtype=...)argument has been deprecated; usenengo_dl.configure_settings(dtype=...)instead.  Will be removed in
1.3.0.1.1.0 (July 24, 2018)AddedThe default TensorFlow Session is now set to the underlying Simulator session
within the Simulator context.Added CLI for benchmarks.pyAddedsim.freeze_paramstool, to more easily extract model parameters for
reuse in different Simulators.Addeddocumentation on saving and loading model parameters.AddedSpaunexample inbenchmarks.pyChangedMovetensorflow-gpuinstallation check to Simulator init, and only apply
ifdevice=None.Switched topylintfor style checks.TensorFlow INFO-level log messages are now disabled by default on importAll previous releases now tracked in documentationUpdated spiking MNIST example to simplify and improve performance.Passing unknown configuration options tonengo_dl.configure_settingswill now give a more explicit error message.Improved speed of parameter fetching thoughget_nengo_paramsRaise a warning if user tries to train a network with non-differentiable
elements (requirestensorflow>=1.9.0)Improved accuracy ofSoftLIFRateimplementation for small values (#45)Simplified howTensorSignalsare loaded into the TensorFlow graphFixedBetter handling of Simulator errors not associated with a specific op (fixes#41)Fixed node outputs changing after simulator is built (fixes#4)Fixed some broken cross references in the documentationFixed several edge cases forget_nengo_params; don’t use trained gains
for direct neuron connections, error raised ifget_nengo_paramsapplied
to an Ensemble with Direct neuronsCompatible withtensorflow==1.9.0releaseFixed bug innengo_dl.configure_settings(session_config=...)when passing
a pre-build model to the Simulator instead of a NetworkFixed TensorFlow version comparisons for 1.10.0DeprecatedSimulator.trangeargumentdthas been deprecated (replaced withsample_every, seehttps://github.com/nengo/nengo/pull/1384)RemovedRemovednengo_dl.DATA_DIRconstantRemovedbenchmarks.compare_backends(usewhitepaper2018_plots.py:compare_backendsinstead)Removedghp-importdependency1.0.0 (May 30, 2018)AddedUser can now directly specify the output error gradient, rather than using
targets/objective (useful for when you have some external process for
computing error that is not easy to implement as an objective function).
Seethe documentationfor details.AddedNengoDL white paperChangedExtra requirements for documentation/testing are now stored insetup.py’sextra_requiresinstead ofrequirements-*.txt.  For example, instead
of doingpip install-rrequirements-test.txt, instead usepip installnengo-dl[tests](orpip install-e.[tests]for a
developer installation).Improved efficiency of PES implementationRemovedRemovedsphinxcontrib-versioningdependency for building documentation0.6.2 (May 4, 2018)AddedAddedsim.get_nengo_paramsfunction to more easily extract
model parameters for reuse when building different models.AddedSimulator(...,progress_bar=False)option to disable the progress
information printed to console when the network is building.TensorFlow session config options can now be set usingnengo_dl.configure_settings(e.g.,nengo_dl.configure_settings(session_config={"gpu_options.allow_growth":True}))The signal sorting/graph simplificaton functions can now be configured
throughnengo_dl.configure_settingsAddedextra_feedsparameter tosim.run/train/loss, which can be
used to feed Tensor values directly into the TensorFlow sessionChangedImproved speed of PES implementation by adding a custom operator.Renamed project fromnengo_dltonengo-dl(to be more consistent with
standard conventions).  This only affects the display name of the project
on PyPI/GitHub, and the documentation now resides athttps://www.nengo.ai/nengo-dl/; there are no functional changes to user code.Minor efficiency improvements to graph plannerAvoid usingtf.constant, to get around TensorFlow’s 2GB limit on graph
size when building large modelsFixedCheckingnengo_dlversion withoutnengoinstalled will no longer
result in an error.Updated progress bar to work withprogressbar2>=3.37.0Updated PES implementation to work with generic synapse types
(seehttps://github.com/nengo/nengo/pull/1095)Fixed installation to work withpip>=10.0Fixed bug when using a TensorNode with apre_buildfunction andsize_in==00.6.1 (March 7, 2018)AddedAdded TensorFlow implementation fornengo.SpikingRectifiedLinearneuron
type.ChangedOptimizer variables (e.g., momentum values) will only be initialized the
first time that optimizer is passed tosim.train.  Subsequent calls tosim.trainwill resume with the values from the previous call.Low-level simulation input/output formats have been reworked to make them
slightly easier to use (for users who want to bypasssim.runorsim.trainand access the TensorFlow session directly).Batch dimension will always be first (if present) when checking model
parameters viasim.data.TensorFlow ops created within the Simulator context will now default to
the same device as the Simulator.Update minimum Nengo version to 2.7.0FixedBetter error message if training data has incorrect rankAvoid reinstalling TensorFlow if one of the nightly build packages is already
installedLowpass synapse can now be applied to multidimensional inputsTensorNodes will no longer be built into the default graph when checking
their output dimensionality.RemovedRemovedutils.cast_dtypefunction0.6.0 (December 13, 2017)AddedTheSoftLIFRateneuron type now has anamplitudeparameter, which
scales the output in the same way as the newamplitudeparameter inLIF/LIFRate(seeNengo PR #1325).Addedprogress_bar=Falseoption tosim.run, which will disable the
information about the simulation status printed to standard output (#17).Added progress bars for the build/simulation process.Added truncated backpropagation option tosim.train(useful for reducing
memory usage during training).  Seethe documentation for details.ChangedChanged the defaulttensorboardargument inSimulatorfromFalsetoNoneUse the newtf.profilertool to collect profiling data insim.run_stepsandsim.trainwhenprofile=True.Minor improvements to efficiency of build process.Minor improvements to simulation efficiency targeting small ops
(tf.reshape/identity/constant).Process inputs are now reseeded for each input when batch processing (if seed
is not manually set).Users can pass a dict of config options for theprofileargument inrun_steps/train, which will be passed on to the TensorFlow
profiler; see thetf.profilerdocumentation for theavailable options.RemovedRemovedbackports.print_functiondependencyFixedFixed a bug where input nodes that were only read as a view were not
feedableUpdatedtensorflow-gpuinstallation checkImproved numerical stability ofLIFRategradients  (#26)Added more informative error message when data is provided with fewer items
thansim.minibatch_size(#30)0.5.2 (October 11, 2017)AddedTensorNode outputs can now define apost_buildfunction that will be
executed after the simulation is initialized (see theTensorNode
documentation for details).Added functionality for outputting summary data during the training process
that can be viewed in TensorBoard (see thesim.train documentation).Added some examples demonstrating how to use Nengo DL in a more complicated
task using semantic pointers to encode/retrieve informationAddedsim.training_stepvariable which will track the current training
iteration (can be used, e.g., for TensorFlow’s variable learning rate
operations).Users can manually createtf.summaryops and pass them tosim.trainsummariesThe Simulator context will now also set the default TensorFlow graph to the
one associated with the Simulator (so any TensorFlow ops created within the
Simulator context will automatically be added to the correct graph)Users can now specify a different objective for each output probe during
training/loss calculation (see thesim.train documentation).ChangedResetting the simulator now only rebuilds the necessary components in the
graph (as opposed to rebuilding the whole graph)The default"mse"loss implementation will now automatically convertnp.nanvalues in the target to zero errorIf there are multiple target probes given tosim.train/sim.lossthe
total error will now be summed across probes (instead of averaged)Fixedsim.datanow implements the fullcollections.MappinginterfaceFixed bug where signal order was non-deterministic for Networks containing
objects with duplicate names
(#9)Fixed bug where non-slot optimizer variables were not initialized
(#11)Implemented a modified PES builder in order to avoid slicing encoders on
non-decoded PES connectionsTensorBoard output directory will be automatically created if it doesn’t
exist0.5.1 (August 28, 2017)Changedsim.data[obj]will now return live parameter values from the simulation,
rather than initial values from the build process.  That means that it can
be used to get the values of object parameters after training, e.g.sim.data[my_conn].weights.Increased minimum Nengo version to 2.5.0.Increased minimum TensorFlow version to 1.3.0.0.5.0 (July 11, 2017)AddedAddednengo_dl.tensor_layerto help with the construction of
layer-style TensorNodes (see theTensorNode documentation)Added an example demonstratinghow to train a neural network
that can run in spiking neuronsAdded some distributions for weight initialization tonengo_dl.distsAddedsim.train(...,profile=True)option to collect profiling
information during trainingAdded new methods to simplify the Nengo operation graph, resulting in faster
simulation/training speedThe default graph planner can now be modified by setting theplannerattribute on the top-level Network configAdded TensorFlow implementation for general linear synapsesAddedbackports.tempfileandbackports.print_functionrequirement for
Python 2.7 systemsChangedIncreased minimum TensorFlow version to 1.2.0Improved error checking for input/target dataImproved efficiency of stateful gradient operations, resulting in faster
training speedThe functionality fornengo_dl.configure_trainablehas been subsumed into
the more generalnengo_dl.configure_settings(trainable=x).  This has
resulted in some small changes to how trainability is controlled within
subnetworks; see theupdated documentationfor details.CallingSimulator.train/Simulator.lossno longer resets the internal
state of the simulation (so they can be safely intermixed with calls toSimulator.run)DeprecatedThe oldstep_blocks/unroll_simulationsyntax has been fully
deprecated, and will result in errors if usedFixedFixed bug related to changing the output of a Node after the model is
constructed (#4)Order of variable creation is now deterministic (helps make saving/loading
parameters more reliable)Configuring whether or not a model element is trainable does not affect
whether or not that element is minibatchedCorrectly reuse variables created inside a TensorNode whenunroll_simulation> 1Correctly handle probes that aren’t connected to any opsSwappedfan_in/fan_outindists.VarianceScalingto align with
the standard definitionsTemporary patch to fix memory leak in TensorFlow (see#11273)Fixed bug related to nodes that had matching output functions but different
size_outFixed bug related to probes that do not contain any data yet0.4.0 (June 8, 2017)AddedAdded ability to manually specify which parts of a model are trainable
(see thesim.train documentation)Added some code examples (see thedocs/examplesdirectory, or thepre-built examples in the documentation)Added the SoftLIFRate neuron type for training LIF networks (based onthis paper)ChangedUpdated TensorFuncParam to new Nengo Param syntaxThe interface for Simulatorstep_blocks/unroll_simulationhas been
changed.  Nowunroll_simulationtakes an integer as argument which is
equivalent to the oldstep_blocksvalue, andunroll_simulation=1is
equivalent to the oldunroll_simulation=False.  For example,Simulator(...,unroll_simulation=True, step_blocks=10)is now equivalent
toSimulator(...,unroll_simulation=10).Simulator.train/Simulator.loss no longer requirestep_blocks(or the newunroll_simulation) to be specified; the number of steps to train across
will now be inferred from the input data.0.3.1 (May 12, 2017)AddedAdded more documentation on Simulator argumentsChangedImproved efficiency of tree_planner, made it the new default plannerFixedCorrectly handle input feeds when n_steps > step_blocksDetect cycles in transitive plannerFix bug in uneven step_blocks roundingFix bug in Simulator.print_paramsFix bug related to merging of learning rule with different dimensionalityUse tf.Session instead of tf.InteractiveSession, to avoid strange side
effects if the simulator isn’t closed properly0.3.0 (April 25, 2017)AddedUse logger for debug/builder outputImplemented TensorFlow gradients for sparse Variable update Ops, to allow
models with those elements to be trainedAdded tutorial/examples on usingSimulator.trainAdded support for training models whenunroll_simulation=FalseCompatibility changes for Nengo 2.4.0Added a new graph planner algorithm, which can improve simulation speed at
the cost of build timeChangedSignificant improvements to simulation speedUse sparse Variable updates for signals.scatter/gatherImproved graph optimizer memory organizationImplemented sparse matrix multiplication op, to allow more aggressive
merging of DotInc operatorsSignificant improvements to build speedAdded early termination to graph optimizationAlgorithmic improvements to graph optimization functionsReorganized documentation to more clearly direct new users to relevant
materialFixedFix bug where passing a built model to the Simulator more than once would
result in an errorCache result of calls totensor_graph.build_loss/build_optimizer, so that
we don’t unnecessarily create duplicate elements in the graph on repeated
callsFix support for Variables on GPU whenunroll_simulation=FalseSimPyFunc operators will always be assigned to CPU, even whendevice="/gpu:0", since there is no GPU kernelFix bug whereSimulator.losswas not being computed correctly for
models with internal stateData/targets passed toSimulator.trainwill be truncated if not evenly
divisible by the specified minibatch sizeFixed bug where in some cases Nodes with side effects would not be run if
their output was not used in the simulationFixed bug where strided reads that cover a full array would be interpreted as
non-strided reads of the full array0.2.0 (March 13, 2017)Initial release of TensorFlow-based NengoDL0.1.0 (June 12, 2016)Initial release of Lasagne-based NengoDL