Skip to content

Commit

Permalink
noisylif module tests
Browse files Browse the repository at this point in the history
  • Loading branch information
genema committed Aug 15, 2023
1 parent a6156f1 commit dd8d8b1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/test_snntorch/test_noisyleaky.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def test_noisyleaky(self, noisyleaky_instance, input_):
spk_rec.append(spk)

assert mem_rec[1] == mem_rec[0] * 0.5 + input_[1]
assert spk_rec[0] == spk_rec[1]
# The firing mechanism is probabilistic and cannot guarantee that the spike output will be
# the same.
# assert spk_rec[0] == spk_rec[1]

def test_noisyleaky_reset(
self,
Expand Down Expand Up @@ -96,8 +98,9 @@ def test_noisyleaky_init_hidden(
for i in range(2):
spk = noisyleaky_hidden_instance(input_[i])
spk_rec.append(spk)

assert spk_rec[0] == spk_rec[1]
# The firing mechanism is probabilistic and cannot guarantee that the spike output will be
# the same.
# assert spk_rec[0] == spk_rec[1]

def test_noisyleaky_init_hidden_reset_zero(
self, noisyleaky_hidden_reset_zero_instance, input_
Expand All @@ -108,8 +111,9 @@ def test_noisyleaky_init_hidden_reset_zero(
for i in range(2):
spk = noisyleaky_hidden_reset_zero_instance(input_[i])
spk_rec.append(spk)

assert spk_rec[0] == spk_rec[1]
# The firing mechanism is probabilistic and cannot guarantee that the spike output will be
# the same.
# assert spk_rec[0] == spk_rec[1]

def test_noisyleaky_init_hidden_reset_none(
self, noisyleaky_hidden_reset_none_instance, input_
Expand All @@ -121,7 +125,9 @@ def test_noisyleaky_init_hidden_reset_none(
spk = noisyleaky_hidden_reset_none_instance(input_[i])
spk_rec.append(spk)

assert spk_rec[0] == spk_rec[1]
# The firing mechanism is probabilistic and cannot guarantee that the spike output will be
# the same.
# assert spk_rec[0] == spk_rec[1]

def test_noisyleaky_cases(self, noisyleaky_hidden_instance, input_):
with pytest.raises(TypeError):
Expand Down

0 comments on commit dd8d8b1

Please sign in to comment.