Skip to content

Question about STDP code in (func: stdp_conv2d_single_step) #292

Answered by AllenYolk
AndyCao1125 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi AndyCao1125! I apologize for the mistakes I made in stdp_conv2d_single_step()! You may check pull request #293 for the new code.

In my original code, the following two lines are placed before the loop:

trace_pre = trace_pre - trace_pre / tau_pre + pre_spike
trace_post = trace_post - trace_post / tau_post + post_spike

However, as you said, pre_spike and post_spike are defined in the loop, and that's why UnboundLocalError: local variable 'pre_spike' referenced before assignment is raised. Actually, my intention here was to use in_spike and out_spike rather than pre_spike and post_spike, but I made a typo🤧. The modified code looks like:

if trace_pre is None:
        trace_pre = torch.zer…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@AndyCao1125
Comment options

Answer selected by AndyCao1125
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants