Overview
hxtorch is a deep learning Python library used for numerical simulation, neuromorphic emulation and training of spiking neural networks (SNNs). Built on top of PyTorch, it integrates the automatic differentiation and modular design of the PyTorch ecosystem with neuromorphic experiment execution, enabling hardware-in-the-loop training workflows on the neuromorphic hardware system BrainScaleS-2 .
The library abstracts the hardware configuration and experiment execution, while allowing users to define networks using familiar PyTorch modules such as LIF and LI neuron layers and synaptic connections. By separating network definition from execution, hxtorch supports both software simulation and hardware emulation within a single, unified API.
The framework supports surrogate gradient-based learning, custom backward functions and seamless conversion between sparse, event-based observables and dense PyTorch tensors. It is designed to facilitate iterative model development, hybrid simulation/emulation and the integration of hardware observables such as spike trains and membrane voltages directly into the training loop.