How does the mnist data given convert into input spikes?

We are trying to understand the code given in the section optimizing spiking neural networks in nengo dl and breaking our head over how the mnist images with pixel values are converted into spike trains. Can someone please explain?

Hello nitty9

Does this response here answer your question Spike Generation from Input Analog Data in Nengo Implementation? If not let me know and I can try to answer any other questions you have!

Yeah, understood that part. I have two more questions.

  1. In step_math function we are using refractory time…where is that coming from and how is it initialized?
  2. What does tf.layers.dense do? Does it create 10 LIF neurons? what is it’s purpose?
    Thanks!!

Regarding the previous question…

The refractory period is defined when constructing the neuron type https://github.com/nengo/nengo/blob/master/nengo/neurons.py#L469 (e.g., nengo.Ensemble(..., neuron_type=nengo.LIF(tau_ref=0.01)).

Note that that refractory_time parameter in the step_math function is not the total refractory period though, it is tracking how much time is left in each neuron’s refractory period. So each time a neuron spikes the corresponding element in refractory_time is reset to tau_ref, and then counts down from there (roughly speaking).

You can read about tf.layers.dense in the TensorFlow documentation https://www.tensorflow.org/api_docs/python/tf/layers/dense. By default it doesn’t apply any nonlinearity, it is just a dense matrix multiplication.

Thanks!