Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for post/pre-synaptic variables in on_post/pre statements #99

Open
kjohnsen opened this issue Mar 25, 2020 · 6 comments
Open

Support for post/pre-synaptic variables in on_post/pre statements #99

kjohnsen opened this issue Mar 25, 2020 · 6 comments

Comments

@kjohnsen
Copy link

kjohnsen commented Mar 25, 2020

I'm trying to run the Clopath et al. 2010 Brian example using brian2genn, but apparently referencing post-synaptic variables in on_post statements is not supported.

Is there a workaround for this? Or would it be possible to implement this? In any case it would be nice to see this in the unsupported features section of the documentation.

@tnowotny
Copy link
Contributor

As I recall it, it is modifying post-synaptic variables in the on_post code which is not supported. However, I am not sure how much this restriction is historic. If I am not mistaken, the learning kernel (where the "on_post" code goes in GeNN) is parallelised along the post-synaptic spiking neurons and hence there would not be a race condition/ unpredictable outcome risk if one would allow "+=" etc modifications of post-synaptic variables (what do you think @neworderofjamie ?).
@mstimberg, I think modifying post-synaptic variables in "on_post" is already restricted on "+=" etc within brian 2 for obvious reasons?

@tnowotny
Copy link
Contributor

tnowotny commented Mar 30, 2020

After discussion with @neworderofjamie , he reminded me that our learning kernel in GeNN is parallelised along incoming synapses so that manipulating post-synaptic variables is indeed a bad idea with unpredictable outcomes.
However, we inspected the Clopath example and it seems very odd that "on_post" in the synapse equations is used to update a filtered post-synaptic voltage trace in the post-synaptic neuron. As @neworderofjamie pointed out to me, this also means an update of the post-synaptic filtered voltage for every synapse, which seems wrong.
Should these traces not be updated in the spike reset code:

reset=('''
      v=V_rest
      x_trace+=x_reset/(taux/ms)
      v_lowpass1 += 10*mV                                   # mimics the depolarisation effect due to a spike
      v_lowpass2 += 10*mV                                   # mimics the depolarisation effect due to a spike
      v_homeo += 0.1*mV 
''')

And then

Post_eq = ('''
            w_plus = A_LTP*x_trace_pre*(v_lowpass2_post/mV - Theta_low/mV)*int(v_lowpass2_post/mV - Theta_low/mV > 0)  # synaptic potentiation
            w_ampa = clip(w_ampa+w_plus, 0, w_max)                                                                     # hard bounds
            ''' )

Or am I having the completely wrong end of the stick @mstimberg ?

@tnowotny
Copy link
Contributor

tnowotny commented Mar 30, 2020

Last comment for today: the not supported error thrown at

raise NotImplementedError('brian2genn does not support '
however seems over-zealous as accessing post-synaptic variables read-only is not a problem afaik. Maybe we can relax that, @mstimberg ?

@kjohnsen
Copy link
Author

I'm new to Brian and am still reading the paper to try and understand their model, but offhand it seems like updating the low-pass on reset would be functionally equivalent. Though there is a delay between when on_post and when reset are executed, I assume?

@mstimberg
Copy link
Member

I agree that putting the update of the low-pass voltage in the reset would make more sense. As @neworderofjamie said, it is a bit weird at the moment because the update will be done for each synapse, i.e. the += 10*mV actually translates into a += 50*mV.

Though there is a delay between when on_post and when reset are executed, I assume?

In "standard Brian", both would be executed in the same time step. According to the schedule, it would check the threshold, propagate the spikes (which includes calling on_post), and execute the reset. In Brian2GeNN this is different, here the synaptic propagation happens in the following time step. But that would only be one more reason to put it into the reset, I think.

@tnowotny :

Last comment for today: the not supported error thrown at [...] however seems over-zealous as accessing post-synaptic variables read-only is not a problem afaik.

I agree, I think we only did this for simplicity....

@tnowotny
Copy link
Contributor

tnowotny commented Apr 1, 2021

This could be looked at again within GSoC2021.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants