Skip to content

Commit

Permalink
Merge pull request #108 from manuelbre/master
Browse files Browse the repository at this point in the history
Detach and Reset Spikes in RLeaky
  • Loading branch information
jeshraghian committed May 25, 2022
2 parents 7b14df8 + 3e502de commit 0409f82
Showing 1 changed file with 4 additions and 1 deletion.
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()

0 comments on commit 0409f82

Please sign in to comment.