traceTorch Documentation
traceTorch is a PyTorch library for stateful recurrent layers, built primarily for spiking neural networks.
It keeps model code close to ordinary PyTorch while handling the parts that usually make recurrent and spiking models awkward: hidden-state initialization, hidden-state resets, truncated history, state persistence, parameter constraints, and feature dimensions that are not necessarily the last dimension.
The short version is:
Inherit models from
tt.Model.Use traceTorch layers inside ordinary PyTorch modules.
Loop over timesteps yourself.
Call
zero_states()when a new sequence starts.Call
detach_states()when you want online or truncated learning.
Where to go first
If you are new to traceTorch, read the documentation in this order:
Installation shows how to install the package and run examples.
Quickstart builds the smallest useful model and training loop.
Introduction explains the mental model: hidden states, timestep loops, SNN naming, and layer choices.
Examples walks through the runnable scripts in the repository.
Tutorials covers save/load, compile/decompile, and custom layer creation.
Reference links the API docstrings.
What traceTorch provides
tt.snn32 leaky-integrator-based SNN layers. The family covers continuous readout layers, binary firing layers, ternary firing layers, scaled ternary layers, dual sign-specific traces, synaptic traces, recurrent traces, and combinations of those mechanisms.
tt.rnnSimpleRNN,LSTM, andGRUlayers adapted to traceTorch’s state-management style. They process one timestep at a time and keep their hidden states internal.tt.ssmS4,S5,S6, andMamba-style layers adapted to traceTorch’s recurrent interface. These are useful for experimentation and composition with traceTorch layers, but they are not replacements for official optimized SSM implementations.tt.Modelandtt.LayerThe core abstractions.
tt.Layergives each layer states, constrained parameters, compilation, and dimension helpers.tt.Modelrecursively manages every traceTorch layer in a model tree.