norse/norse

Deep learning with spiking neural networks (SNNs) in PyTorch.

Norse – Deep‑learning library for spiking neural networks

What it is – Norse is a Python library that adds bio‑inspired, event‑driven neural components (spiking neurons, synapse dynamics, encoders/decoders, etc.) to PyTorch. It lets you build, train and evaluate spiking neural networks (SNNs) with the same tooling you use for conventional deep‑learning models.

Why it matters – Spiking networks are sparse and operate on discrete spikes, offering a closer match to how the brain computes and promising energy‑efficient inference on neuromorphic hardware. Norse gives researchers a production‑ready, PyTorch‑compatible stack so they can experiment with SNNs without abandoning the rich ecosystem of optimizers, data loaders, and distributed training.

Installation – Supports the usual Python package routes:

  • pip install norse
  • conda install -c conda-forge norse
  • Docker image quay.io/norse/norse
  • Install directly from source via pip install git+https://github.com/norse/norse.

Getting started – The project ships ready‑to‑run examples that can be launched with the norse.task module, e.g.:

python -m norse.task.mnist      # train a spiking MNIST classifier
python -m norse.task.cifar10    # train on CIFAR‑10
python -m norse.task.cartpole   # policy‑gradient cart‑pole control

A Google‑Colab notebook demonstrates a spiking convolutional classifier that reaches >99 % MNIST accuracy.

Core API – The most used primitives live under norse.torch:

  • LIFCell / LICell – leaky‑integrate‑and‑fire and leaky integrator neuron layers.
  • SequentialState – a stateful wrapper that lets you stack spiking layers like regular nn.Sequential.
  • LSNNRecurrent – implementation of long short‑term spiking networks (LSNN) for recurrent tasks. These components behave like standard PyTorch modules: they accept tensors, return output spikes and an updated hidden state.

Compatibility – Works with PyTorch ≥ 1.9 and integrates with PyTorch‑Lightning for multi‑GPU training (norse.task.mnist_pl).

Community & support – Active Discord channel, CI badges, code‑coverage reports, and a citation‑ready Zenodo release. The library is LGPL‑v3 licensed and welcomes contributions via the usual GitHub workflow.

When to use it – If you need to prototype SNNs, explore neuromorphic algorithms, or run spike‑based models on GPUs/CPUs before moving to dedicated hardware, Norse provides a high‑level, well‑tested bridge between spiking neuroscience and modern deep‑learning pipelines.