Skip to content

Switch spike tensors from uint8 to bool dtype - #801

Open
md-Yusha wants to merge 1 commit into
BindsNET:masterfrom
md-Yusha:switch-spikes-to-bool-tensors
Open

md-Yusha wants to merge 1 commit into
BindsNET:masterfrom
md-Yusha:switch-spikes-to-bool-tensors

Conversation

@md-Yusha

Copy link
Copy Markdown

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 #318

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch spikes from ByteTensors to BoolTensors

1 participant