https://github.com/nengo/pytorch-spiking
Spiking neuron integration for PyTorch
https://github.com/nengo/pytorch-spiking
deep-learning python pytorch spiking-neural-networks
Last synced: 8 months ago
JSON representation
Spiking neuron integration for PyTorch
- Host: GitHub
- URL: https://github.com/nengo/pytorch-spiking
- Owner: nengo
- License: other
- Created: 2020-08-21T12:39:44.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-18T17:53:32.000Z (9 months ago)
- Last Synced: 2025-04-12T07:51:59.882Z (8 months ago)
- Topics: deep-learning, python, pytorch, spiking-neural-networks
- Language: Python
- Homepage: https://www.nengo.ai/pytorch-spiking/
- Size: 8.52 MB
- Stars: 40
- Watchers: 4
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE.rst
Awesome Lists containing this project
- awesome-snn - nengo/pytorch-spiking - spiking?style=social"/> : Spiking neuron integration for PyTorch. www.nengo.ai/pytorch-spiking/. (Frameworks)
README
.. image:: https://img.shields.io/pypi/v/pytorch-spiking.svg
:target: https://pypi.org/project/pytorch-spiking
:alt: Latest PyPI version
.. image:: https://img.shields.io/pypi/pyversions/pytorch-spiking.svg
:target: https://pypi.org/project/pytorch-spiking
:alt: Python versions
**************
PyTorchSpiking
**************
PyTorchSpiking provides tools for training and running spiking neural networks
directly within the PyTorch framework. The main feature is
``pytorch_spiking.SpikingActivation``, which can be used to transform
any activation function into a spiking equivalent. For example, we can translate a
non-spiking model, such as
.. code-block:: python
torch.nn.Sequential(
torch.nn.Linear(5, 10),
torch.nn.ReLU(),
)
into the spiking equivalent:
.. code-block:: python
torch.nn.Sequential(
torch.nn.Linear(5, 10),
pytorch_spiking.SpikingActivation(torch.nn.ReLU()),
)
Models with SpikingActivation layers can be optimized and evaluated in the same way as
any other PyTorch model. They will automatically take advantage of PyTorchSpiking's
"spiking aware training": using the spiking activations on the forward pass and the
non-spiking (differentiable) activation function on the backwards pass.
PyTorchSpiking also includes various tools to assist in the training of spiking models,
such as `filtering layers
`_.
If you are interested in building and optimizing spiking neuron models, you may also
be interested in `NengoDL `_. See
`this page `_ for a
comparison of the different use cases supported by these two packages.
**Documentation**
Check out the `documentation `_ for
- `Installation instructions
`_
- `More detailed example introducing the features of PyTorchSpiking
`_
- `API reference `_