Choosing a backend#
ELEANOR provides two parallel implementations of every neuron model: JAX
(eleanor.jax) and PyTorch (eleanor.torch). They share parameter names
and parameter defaults, so a model expressed in one backend can usually be
ported to the other line-for-line.
Quick comparison#
Dimension |
JAX ( |
PyTorch ( |
|---|---|---|
Underlying framework |
Equinox modules, |
snnTorch |
API style |
Split |
Single |
Compilation |
|
|
C++/CUDA kernels |
Pure-Python |
Native kernels for Bruno and Heracles |
When to pick JAX#
Functional, pure-functions training loop with explicit PRNG state.
Easy
jax.vmapover devices/parameter sweeps.Variability handling is built around immutable pytrees (
StaticWrapper,D2DVar), which composes naturally withequinox.tree_atpatterns.
When to pick PyTorch#
Existing PyTorch training infrastructure.
You want the native C++/CUDA kernels for Bruno or Heracles.
PyTorch/snnTorch is already part of your stack.
Same model, two backends#
A FeLIF in each backend with parity defaults:
# JAX
from eleanor.jax.models import FeLIFCell, FeLIFParams
cell = FeLIFCell(shape=(1,), params=FeLIFParams(), key=key)
# PyTorch
from eleanor.torch.models import FeLIF
neuron = FeLIF(tau_p=0.6, tau_m=0.95, threshold=1.0, dt=1e-3)
The parameter names match (tau_p, tau_m, threshold, dt, …);
the JAX side groups them into a FeLIFParams dataclass, while the PyTorch
side passes them directly to the constructor.