Skip to content

fix(torch): preserve state dtype on reset - #32

Open
Missing-Identity wants to merge 1 commit into
synsense:developfrom
Missing-Identity:fix/preserve-torch-state-dtype
Open

fix(torch): preserve state dtype on reset#32
Missing-Identity wants to merge 1 commit into
synsense:developfrom
Missing-Identity:fix/preserve-torch-state-dtype

Conversation

@Missing-Identity

Copy link
Copy Markdown

Summary

Fixes #31 by preserving the live tensor dtype when TorchModule.reset_state() regenerates a Torch-backed state value.

  • Reset state tensors now retain both their device and dtype.
  • Add CPU coverage for LIFTorch.to(torch.float64) followed by reset_state().

Validation

  • pytest -q tests/tests_default/test_lif_torch.py — 15 passed, 1 skipped
  • pytest -q tests/tests_default/test_torch_module.py — 7 passed
  • black==22.3.0 --check rockpool/nn/modules/torch/torch_module.py tests/tests_default/test_lif_torch.py
  • git diff --check

Scope note

The current upstream LIFTorch float64 forward path also fails without a reset because its spike-generation implementation emits float32. This PR intentionally fixes only the reset-state dtype regression reported in #31; the broader forward-path issue is separate from this minimal change.

@ssinhaleite

ssinhaleite commented Jul 27, 2026

Copy link
Copy Markdown
Member

Dear @Missing-Identity ,

Thank you so much for opening a PR!
Before I review and merge it, I need you to sign our Contributor's Agreement.

Please send an email to vanessa.leite [at] synsense.ai titled "Contributor's Agreement," and I will share more information with you on how we move forward.

Best,
Vanessa Leite
Senior Software Engineer @ SynSense

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.

LIFTorch.reset_state() silently resets state buffers to float32

2 participants