{"id":13687147,"url":"https://github.com/electronicvisions/norse","last_synced_at":"2026-01-17T09:35:37.256Z","repository":{"id":39611927,"uuid":"217278398","full_name":"electronicvisions/norse","owner":"electronicvisions","description":"Deep learning for spiking neural networks","archived":false,"fork":false,"pushed_at":"2024-04-26T18:29:11.000Z","size":9262,"stargazers_count":63,"open_issues_count":0,"forks_count":10,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-08-03T15:06:20.092Z","etag":null,"topics":["deep-learning","machine-learning","neuromorphic-computing","python","pytorch","spiking-neural-networks","tensors"],"latest_commit_sha":null,"homepage":"https://norse.ai/docs","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/electronicvisions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["cpehle","jegp"]}},"created_at":"2019-10-24T11:02:59.000Z","updated_at":"2024-04-14T23:40:01.000Z","dependencies_parsed_at":"2022-09-15T21:41:17.099Z","dependency_job_id":null,"html_url":"https://github.com/electronicvisions/norse","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electronicvisions%2Fnorse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electronicvisions%2Fnorse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electronicvisions%2Fnorse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electronicvisions%2Fnorse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electronicvisions","download_url":"https://codeload.github.com/electronicvisions/norse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224257487,"owners_count":17281720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","machine-learning","neuromorphic-computing","python","pytorch","spiking-neural-networks","tensors"],"created_at":"2024-08-02T15:00:49.594Z","updated_at":"2026-01-17T09:35:37.183Z","avatar_url":"https://github.com/electronicvisions.png","language":"Python","funding_links":["https://github.com/sponsors/cpehle","https://github.com/sponsors/jegp"],"categories":["Frameworks :computer:"],"sub_categories":["Neuromorphic hardware"],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/norse/norse/master/logo.png\"\u003e\n\u003c/p\u003e\n\nA [deep learning](https://en.wikipedia.org/wiki/Deep_learning) library for [spiking neural networks](https://en.wikipedia.org/wiki/Spiking_neural_network).\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/norse/norse/actions\"\u003e\n        \u003cimg src=\"https://github.com/norse/norse/workflows/Python%20package/badge.svg\" alt=\"Test status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/norse/\" alt=\"PyPi\"\u003e\n        \u003cimg src=\"https://img.shields.io/pypi/v/norse\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://anaconda.org/norse\" alt=\"Conda\"\u003e\n        \u003cimg src=\"https://img.shields.io/conda/v/norse/norse\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/norse/norse/pulse\" alt=\"Activity\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/last-commit/norse/norse\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://discord.gg/7fGN359\"\u003e\n        \u003cimg src=\"https://img.shields.io/discord/723215296399147089\"\n            alt=\"chat on Discord\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.codacy.com/gh/norse/norse?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=norse/norse\u0026amp;utm_campaign=Badge_Grade\"\u003e\u003cimg src=\"https://app.codacy.com/project/badge/Grade/a9ab846fc6114afda4320badcb8a69c2\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/norse/norse\"\u003e\u003cimg src=\"https://codecov.io/gh/norse/norse/branch/master/graph/badge.svg\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://doi.org/10.5281/zenodo.4422025\"\u003e\u003cimg src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.4422025.svg\" alt=\"DOI\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nNorse aims to exploit the advantages of bio-inspired neural components, which are sparse and event-driven - a fundamental difference from artificial neural networks.\nNorse expands [PyTorch](https://pytorch.org/) with primitives for bio-inspired neural components, \nbringing you two advantages: a modern and proven infrastructure based on PyTorch and deep learning-compatible spiking neural network components.\n\n**Documentation**: [norse.github.io/norse/](https://norse.github.io/norse/)\n\n## 1. Getting started\n\nThe fastest way to try Norse is via the [jupyter notebooks on Google collab](https://github.com/norse/notebooks/tree/master/).\n\nAlternatively, [you can install Norse locally](#installation) and run one of the [included tasks](https://norse.github.io/norse/tasks.html) such as [MNIST](https://en.wikipedia.org/wiki/MNIST_database):\n```bash\npython -m norse.task.mnist\n```\n\n## 2. Using Norse\n\nNorse presents plug-and-play components for deep learning with spiking neural networks.\nHere, we describe how to install Norse and start to apply it in your own work.\n[Read more in our documentation](https://norse.github.io/norse/working.html).\n\n### 2.1. Installation\n\u003ca name=\"installation\"\u003e\u003c/a\u003e\n\nWe assume you are using **Python version 3.7+** and have **installed PyTorch version 1.9 or higher**. \n[Read more about the prerequisites in our documentation](https://norse.github.io/norse/installing.html).\n\n\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eMethod\u003c/th\u003e\u003cth\u003eInstructions\u003c/th\u003e\u003cth\u003ePrerequisites\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\n\u003ctr\u003e\n\u003ctd\u003eFrom PyPi\u003c/td\u003e\u003ctd\u003e\u003cdiv class=\"highlight highlight-source-shell\"\u003e\u003cpre\u003e\npip install norse\n\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\u003ctd\u003e\u003ca href=\"https://pypi.org/\" title=\"PyPi\"\u003ePip\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eFrom source\u003c/td\u003e\u003ctd\u003e\u003cdiv class=\"highlight highlight-source-shell\"\u003e\u003cpre\u003e\npip install -qU git+https://github.com/norse/norse\n\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\u003ctd\u003e\u003ca href=\"https://pypi.org/\" title=\"PyPi\"\u003ePip\u003c/a\u003e, \u003ca href=\"https://pytorch.org/get-started/locally/\" title=\"PyTorch\"\u003ePyTorch\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eWith Docker\u003c/td\u003e\u003ctd\u003e\u003cdiv class=\"highlight highlight-source-shell\"\u003e\u003cpre\u003e\ndocker pull quay.io/norse/norse\n\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\u003ctd\u003e\u003ca href=\"https://www.docker.com/get-started\" title=\"Docker\"\u003eDocker\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eFrom Conda\u003c/td\u003e\u003ctd\u003e \u003cdiv class=\"highlight highlight-source-shell\"\u003e\u003cpre\u003e\nconda install -c norse norse\n\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\u003ctd\u003e\u003ca href=\"https://docs.anaconda.com/anaconda/install/\" title=\"Anaconda\"\u003eAnaconda\u003c/a\u003e or \u003ca href=\"https://docs.conda.io/en/latest/miniconda.html\" title=\"Miniconda\"\u003eMiniconda\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\nFor troubleshooting, please refer to our [installation guide](https://norse.github.io/norse/pages/installing.html#installation-troubleshooting), [create an issue on GitHub](https://github.com/norse/norse/issues) or [write us on Discord](https://discord.gg/7fGN359).\n\n### 2.2. Running examples\n\nNorse is bundled with a number of example tasks, serving as short, self contained, correct examples ([SSCCE](http://www.sscce.org/)).\nThey can be run by invoking the `norse` module from the base directory.\nMore information and tasks are available [in our documentation](https://norse.github.io/norse/tasks.html) and in your console by typing: `python -m norse.task.\u003ctask\u003e --help`, where `\u003ctask\u003e` is one of the task names.\n\n- To train an MNIST classification network, invoke\n    ```bash\n    python -m norse.task.mnist\n    ```\n- To train a CIFAR classification network, invoke\n    ```bash\n    python -m norse.task.cifar10\n    ```\n- To train the cartpole balancing task with Policy gradient, invoke\n    ```bash\n    python -m norse.task.cartpole\n    ```\n\nNorse is compatible with [PyTorch Lightning](https://pytorch-lightning.readthedocs.io/en/stable/),\nas demonstrated in the [PyTorch Lightning MNIST task variant](https://github.com/norse/norse/blob/master/norse/task/mnist_pl.py) (requires PyTorch lightning):\n\n```bash\npython -m norse.task.mnist_pl --gpus=4\n```\n\n### 2.3. Example: Spiking convolutional classifier \n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/norse/notebooks/blob/master/mnist_classifiers.ipynb)\n\nThis classifier is a taken from our [tutorial on training a spiking MNIST classifier](https://github.com/norse/notebooks#level-intermediate) and achieves \u003e99% accuracy.\n\n```python\nimport torch, torch.nn as nn\nfrom norse.torch import LICell             # Leaky integrator\nfrom norse.torch import LIFCell            # Leaky integrate-and-fire\nfrom norse.torch import SequentialState    # Stateful sequential layers\n\nmodel = SequentialState(\n    nn.Conv2d(1, 20, 5, 1),      # Convolve from 1 -\u003e 20 channels\n    LIFCell(),                   # Spiking activation layer\n    nn.MaxPool2d(2, 2),\n    nn.Conv2d(20, 50, 5, 1),     # Convolve from 20 -\u003e 50 channels\n    LIFCell(),\n    nn.MaxPool2d(2, 2),\n    nn.Flatten(),                # Flatten to 800 units\n    nn.Linear(800, 10),\n    LICell(),                    # Non-spiking integrator layer\n)\n\ndata = torch.randn(8, 1, 28, 28) # 8 batches, 1 channel, 28x28 pixels\noutput, state = model(data)      # Provides a tuple (tensor (8, 10), neuron state)\n```\n\n### 2.4. Example: Long short-term spiking neural networks\nThe long short-term spiking neural networks from the paper by [G. Bellec, D. Salaj, A. Subramoney, R. Legenstein, and W. Maass (2018)](https://arxiv.org/abs/1803.09574) is another interesting way to apply norse: \n```python\nimport torch\nfrom norse.torch import LSNNRecurrent\n# Recurrent LSNN network with 2 input neurons and 10 output neurons\nlayer = LSNNRecurrent(2, 10)\n# Generate data: 20 timesteps with 8 datapoints per batch for 2 neurons\ndata  = torch.zeros(20, 8, 2)\n# Tuple of (output spikes of shape (20, 8, 2), layer state)\noutput, new_state = layer(data)\n```\n\n## 3. Why Norse?\n\nNorse was created for two reasons: to 1) apply findings from decades of research in practical settings\nand to 2) accelerate our own research within bio-inspired learning.\n\nWe are passionate about Norse: we strive to follow best practices and promise to maintain this library for the\nsimple reason that we depend on it ourselves.\nWe have implemented a number of neuron models, synapse dynamics, encoding and decoding algorithms, \ndataset integrations, tasks, and examples.\nCombined with the PyTorch infrastructure and our high coding standards, we have found Norse to be an excellent tool for modelling *scaleable* experiments and [Norse is actively being used in research](https://norse.github.io/norse/papers.html).\n\nFinally, we are working to keep Norse as performant as possible. \nPreliminary benchmarks suggest that Norse [achieves excellent performance on small networks of up to ~5000 neurons per layer](https://github.com/norse/norse/tree/master/norse/benchmark). \nAided by the preexisting investment in scalable training and inference with PyTorch, Norse scales from a single laptop to several nodes on an HPC cluster with little effort.\nAs illustrated by our [PyTorch Lightning example task](https://norse.github.io/norse/tasks.html#mnist-in-pytorch-lightning).\n\n\n[Read more about Norse in our documentation](https://norse.github.io/norse/about.html).\n\n## 4. Similar work\nThe list of projects below serves to illustrate the state of the art, while explaining our own incentives to create and use norse.\n\n* [BindsNET](https://github.com/BindsNET/bindsnet) also builds on PyTorch and is explicitly targeted at machine learning tasks. It implements a Network abstraction with the typical 'node' and 'connection' notions common in spiking neural network simulators like nest.\n* [cuSNN](https://github.com/tudelft/cuSNN) is a C++ GPU-accelerated simulator for large-scale networks. The library focuses on CUDA and includes spike-time dependent plasicity (STDP) learning rules.\n* [decolle](https://github.com/nmi-lab/decolle-public) implements an online learning algorithm described in the paper [\"Synaptic Plasticity Dynamics for Deep Continuous Local Learning (DECOLLE)\"](https://arxiv.org/abs/1811.10766) by J. Kaiser, M. Mostafa and E. Neftci.\n* [GeNN](http://genn-team.github.io/genn/) compiles SNN network models to NVIDIA CUDA to achieve high-performing SNN model simulations.\n* [Long short-term memory Spiking Neural Networks (LSNN)](https://github.com/IGITUGraz/LSNN-official) is a tool from the University of Graaz for modelling LSNN cells in [Tensorflow](https://www.tensorflow.org/). The library focuses on a single neuron and gradient model.\n* [Nengo](https://www.nengo.ai/nengo-dl/introduction.html) is a neuron simulator, and Nengo-DL is a deep learning network simulator that optimised spike-based neural networks based on an approximation method suggested by [Hunsberger and Eliasmith (2016)](https://arxiv.org/abs/1611.05141).\n* [Nengo PyTorch](https://github.com/nengo/pytorch-spiking) a thin wrapper for PyTorch that adds a single voltage-only spiking model. The approach is independent from the Nengo framework.\n* [Neuron Simulation Toolkit (NEST)](https://nest-simulator.org) constructs and evaluates highly detailed simulations of spiking neural networks. This is useful in a medical/biological sense but maps poorly to large datasets and deep learning.\n* [PyNN](http://neuralensemble.org/docs/PyNN/) is a Python interface that allows you to define and simulate spiking neural network models on different backends (both software simulators and neuromorphic hardware). It does not currently provide mechanisms for optimisation or arbitrary synaptic plasticity.\n* [PySNN](https://github.com/BasBuller/PySNN/) is a PyTorch extension similar to Norse. Its approach to model building is slightly different than Norse in that the neurons are stateful.\n* [Rockpool](https://gitlab.com/aiCTX/rockpool) is a Python package developed by SynSense for training, simulating and deploying spiking neural networks. It offers both JAX and PyTorch primitives.\n* [Sinabs](https://gitlab.com/synsense/sinabs) is a PyTorch extension by [SynSense](https://www.synsense-neuromorphic.com/). It mainly focuses on convolutions and translation to neuromorphic hardware.\n* [SlayerPyTorch](https://github.com/bamsumit/slayerPytorch) is a **S**pike **LAY**er **E**rror **R**eassignment library, that focuses on solutions for the temporal credit problem of spiking neurons and a probabilistic approach to backpropagation errors. It includes support for the [Loihi chip](https://en.wikichip.org/wiki/intel/loihi).\n* [SNN toolbox](https://snntoolbox.readthedocs.io/en/latest/guide/intro.html) \u003cq\u003eautomates the conversion of pre-trained analog to spiking neural networks\u003c/q\u003e. The tool is solely for already trained networks and omits the (possibly platform specific) training.\n* [snnTorch](https://snntorch.readthedocs.io/en/latest/) is a simulator built on PyTorch, featuring several [introduction tutorials](https://snntorch.readthedocs.io/en/latest/tutorials/index.html) on deep learning with SNNs.\n* [SpikingJelly](https://github.com/fangwei123456/spikingjelly) is another PyTorch-based spiking neural network simulator. SpikingJelly uses stateful neurons. [Example of training a network on MNIST](https://spikingjelly.readthedocs.io/zh_CN/latest/clock_driven_en/3_fc_mnist.html).\n* [SpyTorch](https://github.com/fzenke/spytorch) presents a set of tutorials for training SNNs with the surrogate gradient approach SuperSpike by [F. Zenke, and S. Ganguli (2017)](https://arxiv.org/abs/1705.11146). Norse [implements the SuperSpike surrogate gradient function](https://github.com/norse/norse/blob/master/norse/torch/functional/superspike.py), but allows for other surrogate gradients and training approaches.\n* [s2net](https://github.com/romainzimmer/s2net) is based on the implementation presented in [SpyTorch](https://github.com/fzenke/spytorch), but implements convolutional layers as well. It also contains a demonstration how to use those primitives to train a model on the [Google Speech Commands dataset](https://arxiv.org/abs/1804.03209).\n\n\n## 5. Contributing\n\nContributions are warmly encouraged and always welcome. However, we also have high expectations around the code base so if you wish to contribute, please refer to our [contribution guidelines](contributing.md).\n\n## 6. Credits\n\nNorse is created by\n* [Christian Pehle](https://www.kip.uni-heidelberg.de/people/10110) (@GitHub [cpehle](https://github.com/cpehle/)), PostDoc at University of Heidelberg, Germany.\n* [Jens E. Pedersen](https://www.kth.se/profile/jeped) (@GitHub [jegp](https://github.com/jegp/)), doctoral student at KTH Royal Institute of Technology, Sweden.\n\nMore information about Norse can be found [in our documentation](https://norse.github.io/norse/about.html). The research has received funding from the EC Horizon 2020 Framework Programme under Grant Agreements 785907 and 945539 (HBP) and by the Deutsche Forschungsgemeinschaft (DFG, German Research Fundation) under Germany's Excellence Strategy EXC 2181/1 - 390900948 (the Heidelberg STRUCTURES Excellence Cluster).\n\n## 7. Citation\n\nIf you use Norse in your work, please cite it as follows:\n\n```BibTex\n@software{norse2021,\n  author       = {Pehle, Christian and\n                  Pedersen, Jens Egholm},\n  title        = {{Norse -  A deep learning library for spiking \n                   neural networks}},\n  month        = jan,\n  year         = 2021,\n  note         = {Documentation: https://norse.ai/docs/},\n  publisher    = {Zenodo},\n  version      = {0.0.7},\n  doi          = {10.5281/zenodo.4422025},\n  url          = {https://doi.org/10.5281/zenodo.4422025}\n}\n```\n\nNorse is actively applied and cited in the literature. We are keeping track of the papers cited by Norse [in our documentation](https://norse.github.io/norse/papers.html).\n\n## 8. License\n\nLGPLv3. See [LICENSE](LICENSE) for license details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectronicvisions%2Fnorse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felectronicvisions%2Fnorse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectronicvisions%2Fnorse/lists"}