Skip to content

Commit

Permalink
Merge pull request #109 from synsense/hotfix/reset_mechanism
Browse files Browse the repository at this point in the history
Correct test whether subtract value is None
  • Loading branch information
Nogay Küpelioğlu authored Aug 30, 2023
2 parents c03ea75 + ba9a157 commit 091fb56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sinabs/activation/reset_mechanism.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MembraneSubtract:

def __call__(self, spikes, state, threshold):
new_state = state.copy()
if self.subtract_value:
if self.subtract_value is not None:
new_state["v_mem"] = new_state["v_mem"] - spikes * self.subtract_value
else:
new_state["v_mem"] = new_state["v_mem"] - spikes * threshold
Expand Down
6 changes: 6 additions & 0 deletions tests/test_activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
torch.tensor([1.0, 0.0]),
torch.tensor([1.5, 0.3]),
),
(
SingleSpike,
MembraneSubtract(subtract_value=torch.tensor([0.9, 1.1])),
torch.tensor([1.0, 0.0]),
torch.tensor([1.6, 0.3]),
),
(
SingleSpike,
MembraneReset(),
Expand Down

0 comments on commit 091fb56

Please sign in to comment.