Conversation
torch has supported a native bool dtype since 1.2 (2019), but Nodes.s and its downstream consumers were still allocated as uint8. This meant spike checks relied on comparison hacks like (s > 0) instead of direct boolean semantics, and precluded using logical ops (&, |, ~, .any(), .all()) directly on spike tensors. Changes: - Nodes.__init__ / reset_state_variables: self.s now allocated with dtype=torch.bool - Learning rules (learning.py): explicit .float() casts added where spikes are used in arithmetic weight updates - Encoders (encoding.py): output dtype aligned to bool at the spike-train boundary Closes BindsNET#318
|
Hi @md-Yusha, Thank you for picking this up and for helping with BindsNET! There are a few changes I would like before we merge:
Don't worry about the black and isort failures, we will run them on our side. Let me know what you think. |
|
Thanks for the detailed review, @Hananel-Hazan — the conversion test numbers on Input.forward are a great catch, I hadn't thought about RealInput being merged in back in 2019. Here's what I'll fix:
Leaving black/isort as-is per your note. Will push an updated commit soon. |
torch has supported a native bool dtype since 1.2 (2019), but Nodes.s and its downstream consumers were still allocated as uint8. This meant spike checks relied on comparison hacks like (s > 0) instead of direct boolean semantics, and precluded using logical ops (&, |, ~, .any(), .all()) directly on spike tensors.
Changes:
Closes #318