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

Detach and Reset Spikes in RLeaky #108

Merged
merged 1 commit into from May 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion snntorch/_neurons/rleaky.py
Expand Up @@ -242,6 +242,8 @@ def detach_hidden(cls):
for layer in range(len(cls.instances)):
if isinstance(cls.instances[layer], RLeaky):
cls.instances[layer].mem.detach_()
cls.instances[layer].spk.detach_()


@classmethod
def reset_hidden(cls):
Expand All @@ -250,4 +252,5 @@ def reset_hidden(cls):
Assumes hidden states have a batch dimension already."""
for layer in range(len(cls.instances)):
if isinstance(cls.instances[layer], RLeaky):
cls.instances[layer].mem = _SpikeTensor(init_flag=False)
cls.instances[layer].spk, cls.instances[layer].mem = cls.instances[layer].init_rleaky()