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

Spike times shifted #10

Closed
smonsays opened this issue Apr 30, 2021 · 4 comments
Closed

Spike times shifted #10

smonsays opened this issue Apr 30, 2021 · 4 comments

Comments

@smonsays
Copy link

smonsays commented Apr 30, 2021

I have the impression that the spike recordings are shifted one time step in all tutorials. Could you maybe check if this is indeed the case?

From my understanding, time step 0 is recorded twice for the spikes, once during initialisation

  mem = torch.zeros((batch_size, nb_hidden), device=device, dtype=dtype)
  spk_rec = [mem]

and once within the simulation of time step 0:

  for t in range(nb_steps):
      mthr = mem-1.0
      out = spike_fn(mthr)
      ...
      spk_rec.append(out)

As a result the indeces appear shifted when comparing

print(torch.nonzero((mem_rec-1.0) > 0.0))
print(torch.nonzero(spk_rec))

Thanks,
Simon

@fzenke
Copy link
Owner

fzenke commented Apr 30, 2021

You are right. It's better to initialize the recordings as empty lists.

@fzenke fzenke closed this as completed in a570de9 Apr 30, 2021
@smonsays
Copy link
Author

Thanks for the quick response!

Just to clarify since I think I am missing something: With both recordings initialized as empty lists, the offset I was referring to persists, i.e. spk_rec[i] now corresponds to mem_rec[i-1]. If we assume that spiking is instantaneous and happens within the same time step as the membrane potential crosses the threshold, this is what appeared to be inconsistent to me.

@fzenke
Copy link
Owner

fzenke commented May 1, 2021

Does the issue still persist with the new commit? We changed the order in which the new state is updated and add to the list.

@smonsays
Copy link
Author

smonsays commented May 1, 2021

Ah yes, that solved it, I think!

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

No branches or pull requests

2 participants