Skip to content

Commit

Permalink
mod to stdp syn
Browse files Browse the repository at this point in the history
  • Loading branch information
ago109 committed Jul 7, 2024
1 parent acae17a commit 72476bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ngclearn/components/synapses/hebbian/STDPSynapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ def _compute_update(Aplus, Aminus, tau_plus, tau_minus, preSpike, postSpike,
post_m = (post_tols > 0.) * 1.
pre_m = (pre_tols > 0.) * 1.
t_delta = ((weights * 0 + 1.) * post_tols) - pre_tols.T ## t_delta.shape = weights.shape
t_delta = t_delta * post_m * pre_m.T
t_delta = t_delta * post_m * pre_m.T ## mask out zero tols
## calculate post-synaptic term
postTerm = jnp.exp(-t_delta/tau_plus)
postTerm = jnp.exp(-t_delta/tau_plus) * (t_delta > 0.)
dWpost = postTerm * (postSpike * Aplus)
dWpre = 0.
if Aminus > 0.:
## calculate pre-synaptic term
preTerm = jnp.exp(-t_delta / tau_minus)
preTerm = jnp.exp(-t_delta / tau_minus) * (t_delta < 0.)
dWpre = -preTerm * (preSpike.T * Aminus)
## calc final weighted adjustment
dW = (dWpost + dWpre)
Expand Down

0 comments on commit 72476bc

Please sign in to comment.