Question about STDP code in (func: stdp_conv2d_single_step) #292
-
Hi, I have a question when I'm runing STDP training, only using STDP for updating nn.conv2d.
But And I fix the code into:
However, another problem is that the shape of pre_spk & post_spk always do not have the correct shape due to the post spk is sometimes generated after a maxpool layer, but this func (stdp_conv2d_single_step) can only receive the information of current nn.conv. For example, when prespk = in_spike[:, :, h:h_end:stride_h, w:w_end:stride_w] , its shape = [N, C, 32, 32] and if here we have a nn. Maxpool after the nn.conv2d, this func will receive the postspk after maxpool with shape = out_spike = [N, C,16, 16], but this function do not know. So, the calculation could not continued since the shape is not indentity. Could you help me solve this problem? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi AndyCao1125! I apologize for the mistakes I made in In my original code, the following two lines are placed before the loop:
However, as you said,
The second mistake occurs in the loop. The original code for computing
and there's a shape mismatch here. The modified code looks like
|
Beta Was this translation helpful? Give feedback.
-
I do not fully understand the "maxpooling" example you proposed🤧. Did you mean:
If it was case 3, you should specify the
Do you have any suggestions on extending |
Beta Was this translation helpful? Give feedback.
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:
However, as you said,
pre_spike
andpost_spike
are defined in the loop, and that's whyUnboundLocalError: local variable 'pre_spike' referenced before assignment
is raised. Actually, my intention here was to usein_spike
andout_spike
rather thanpre_spike
andpost_spike
, but I made a typo🤧. The modified code looks like: