Skip to main content

Deep learning with spiking neural networks.

Project description

Introduction

https://img.shields.io/pypi/v/snntorch.svg https://github.com/jeshraghian/snntorch/actions/workflows/build.yml/badge.svg Documentation Status https://github.com/jeshraghian/snntorch/blob/master/docs/_static/img/snntorch_alpha_scaled.png?raw=true

The brain is the perfect place to look for inspiration to develop more efficient neural networks. One of the main differences with modern deep learning is that the brain encodes information in spikes rather than continuous activations. snnTorch is a Python package for performing gradient-based learning with spiking neural networks. Rather than reinventing the wheel, it sits on top of PyTorch and takes advantage of its GPU accelerated tensor computation. Pre-designed spiking neuron models are seamlessly integrated within the PyTorch framework and can be treated as recurrent activation units.

https://github.com/jeshraghian/snntorch/blob/master/docs/_static/img/spike_excite_alpha_ps2.gif?raw=true

snnTorch Structure

snnTorch contains the following components:

Component

Description

snntorch

a spiking neuron library like torch.nn, deeply integrated with autograd

snntorch.backprop

variations of backpropagation commonly used with SNNs

snntorch.spikegen

a library for spike generation and data conversion

snntorch.spikeplot

visualization tools for spike-based data using matplotlib and celluloid

snntorch.surrogate

optional surrogate gradient functions

snntorch.utils

dataset utility functions

snnTorch is designed to be intuitively used with PyTorch, as though each spiking neuron were simply another activation in a sequence of layers. It is therefore agnostic to fully-connected layers, convolutional layers, residual connections, etc.

At present, the neuron models are represented by recursive functions which removes the need to store membrane potential traces for all neurons in a system in order to calculate the gradient. The lean requirements of snnTorch enable small and large networks to be viably trained on CPU, where needed. Provided that the network models and tensors are loaded onto CUDA, snnTorch takes advantage of GPU acceleration in the same way as PyTorch.

Citation

Under preparation.

Requirements

The following packages need to be installed to use snnTorch:

  • torch >= 1.2.0

  • numpy >= 1.17

  • pandas

  • matplotlib

  • math

  • celluloid

Installation

Run the following to install:

$ python
$ pip install snntorch

To install snnTorch from source instead:

$ git clone https://github.com/jeshraghian/snnTorch
$ cd snnTorch
$ python setup.py install

API & Examples

A complete API is available here. Examples, tutorials and Colab notebooks are provided.

Getting Started

Here are a few ways you can get started with snnTorch:

Contributing

If you’re ready to contribute to snnTorch, instructions to do so can be found here.

Acknowledgments

snnTorch was initially developed by Jason K. Eshraghian in the Lu Group (University of Michigan).

Additional contributions were made by Xinxin Wang, Vincent Sun, and Emre Neftci.

Several features in snnTorch were inspired by the work of Friedemann Zenke, Emre Neftci, Doo Seok Jeong, Sumit Bam Shrestha and Garrick Orchard.

History

0.1.2 (2021-02-11)

  • Alpha-1 release.

0.0.1 (2021-01-20)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snntorch-0.2.11.tar.gz (12.0 MB view hashes)

Uploaded Source

Built Distribution

snntorch-0.2.11-py2.py3-none-any.whl (28.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page