Skip to content

RLeaky and RSynaptic fail under float64 with dtype mismatch during forward pass #421

Description

@GraceDyer

Summary

I encountered a reproducible issue when running recurrent snnTorch neuron modules in float64. Specifically, RLeaky and RSynaptic fail during forward execution with a dtype mismatch error.

This appears to affect high-precision workflows where users may reasonably expect model.double() or float64 inputs/states to work consistently.

Minimal reproduction

import torch
import snntorch as snn

x = torch.randn(2, 4, dtype=torch.float64)

rleaky = snn.RLeaky(beta=0.9, linear_features=4).double()
rleaky(x)

A similar failure is also reproducible with RSynaptic under the same float64 setup.

Expected behavior

Recurrent neuron modules should either:

  • run correctly in float64 when the module and inputs are converted to float64, or
  • fail with a clearly documented limitation if float64 is not intended to be supported.

Actual behavior

The forward pass fails with:

RuntimeError: mat1 and mat2 must have the same dtype, but got Float and Double

In my reproduction/validation runs, this behavior was stable across repeated reruns and affected at least:

  • RLeaky
  • RSynaptic

Environment

  • torch: 2.8.0
  • snntorch: 0.9.4
  • python: 3.10

Additional notes

This issue matters for high-precision or numerically sensitive workflows, where converting the model and inputs to float64 is a reasonable expectation.

If float64 support is intentionally limited for these recurrent modules, an explicit documentation note or earlier validation error would still be very helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions