Can TensorFlow support spiking neurons?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Can TensorFlow support spiking neurons?



I looked around for tutorials/articles/examples/... to use spiking neurons (e.g. of the SRM/Spike Response Model type) in TensorFlow, but I could not find anything.



Is it possible to simulate these models in TensorFlow at all?
Can TensorFlow simulate models which explicitely depend on time?
Are there any plug-ins/extensions/data files which can add this capability?
Is the GPU supported?




3 Answers
3



I was also interested in this problem and have done exactly what Pietro mentioned. i.e. Took a matlab implementation of a simplified Hodgkin-Huxley model and converted it to Tensorflow.
Have a look at https://github.com/jotia1/spiking-net-tensorflow



https://joshuaarnold.com.au/simulating-spiking-nets-in-tensorflow/ for the blog post with some of my thoughts on the whole process. broken link



Interested in hearing your thoughts on it.





This doesn't seem like an answer. Please refer to How to Answer
– cosmoonot
Apr 20 '17 at 1:07





This is an article and example of a spiking network in tensorflow, it addresses the first question of whether this is possible and gives and example.
– joti
Apr 20 '17 at 1:28



Yes tensorflow can implement spiking neuron models. It is a general purpose computation framework.



Is there an implementation available: I don't think so but I have a friend who is interested in this project.



The GPU is supported for many/most of the tensorflow operations. You'll have to check the docs to see which ones are not supported.





Can you give any link, please?
– Pietro
Jan 16 '17 at 17:49





a link to my friend who's interested?
– Steven
Jan 17 '17 at 3:09





No, just a link regarding your sentence: "Yes tensorflow can implement spiking neuron models".
– Pietro
Jan 17 '17 at 9:29





There is no direct link anywhere online. Just conversations I've had with Nicolas Brunel and my own knowledge about both computer science and neuroscience. Spiking neuron models have been coded up in matlab and tensorflow isn't missing any functionality that matlab has so therefore it can be coded up in tf. The main differences between the two are semantics and under the hood implementations or external third party libraries but both can code up the same material.
– Steven
Jan 17 '17 at 21:52





As pointed out by Steven, Tensorflow is a computation framework and as such allows implementing any algorithm.



The main difference between Tensorflow and other computation framework like Matlab or numpy/scipy is that it relies on computation graphs: you do not perform the operations directly, but instead build a graph of operations that is later evaluated inside a session.



I was also interested in Spiking neurons and Tensorflow and found that question. As joti, I implemented the same Matlab exercise in Tensorflow (link to my blog post)



Here are for instance two operations defining the membrane and recovery factor increments assuming you provide u, v and i:


n = 10
SPIKING_THRESHOLD = 35.0

v = tf.placeholder(tf.float32, shape=[n])
u = tf.placeholder(tf.float32, shape=[n])
i = tf.placeholder(tf.float32)

# Evaluate which neurons have reached the spiking threshold
has_fired_op = tf.greater_equal(v, tf.constant(SPIKING_THRESHOLD, shape=v.shape))

# Evaluate membrane potential increment for the considered time interval
# dv = 0 if the neuron fired, dv = 0.04v*v + 5v + 140 + I -u otherwise
dv_op = tf.where(has_fired_op,
tf.zeros(v.shape),
tf.subtract(tf.add_n([tf.multiply(tf.square(v), 0.04),
tf.multiply(v, 5.0),
tf.constant(140.0, shape=v.shape),
i]),
self.u))

# Evaluate membrane recovery decrement for the considered time interval
# du = 0 if the neuron fired, du = a*(b*v -u) otherwise
du_op = tf.where(has_fired_op,
tf.zeros([v.shape]),
tf.multiply(A, tf.subtract(tf.multiply(B, v), u)))



And you evaluate them like that:


with tf.Session() as sess:

sess.run(tf.global_variables_initializer())

feed = {u: np.full((n), -13.0), v: np.full((n), -65.0), i : 7.0}

dv, du = sess.run([dv_op, du_op], feed_dict=feed)



Note that this is just an example to illustrate how Tensorflow works, and not an actual simulation of spiking neuron: usually you want to evaluate also u and v based on synaptic input (in that case, the placeholders will be the synapse inputs).






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived