Repository navigation
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. |
|
Hi @md-Yusha, thanks again for picking this up. Since September, master has changed a lot (the 0.3.5 bug fixes in #831 and the new test checks in #832), so this branch now conflicts with master. Because this changes the type that encoders return ( Could you bring the branch up to date with master and push the six changes from my review on 2026-09-22 within two weeks, by 2026-11-12? If we don't hear back by then, we will finish it ourselves on our side and keep you credited as co-author. Thanks! |
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