nengo / nengo-dl

Deep learning integration for Nengo
https://www.nengo.ai/nengo-dl
Other
88 stars 22 forks source link

Allow Simulator learning phase to be controlled by global Keras learning phase #108

Closed drasmuss closed 4 years ago

drasmuss commented 4 years ago

By default, the Nengo DL simulator will use the learning phase as set by Keras (i.e. "test" mode for predict/evaluate, and "train" mode for fit). However, sometimes it can be useful to be able to override Keras' default behaviour (e.g. if we want to use "train" mode in predict, so that we can check the output of a spiking model after its neurons are swapped to the rate equivalents).

This allows the learning phase to be overridden by setting the global Keras learning phase (using, e.g. tf.keras.backend.set_learning_phase) before the Simulator is constructed.

Also added an option to control the input values in check_gradients (for when we don't want to evaluate the gradients at zero).

drasmuss commented 4 years ago

Note: this is based on https://github.com/nengo/nengo-dl/pull/107