nengo / pytorch-spiking

Spiking neuron integration for PyTorch
https://www.nengo.ai/pytorch-spiking/
Other
39 stars 6 forks source link
deep-learning python pytorch spiking-neural-networks

.. 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 <https://www.nengo.ai/pytorch-spiking/reference.html#module-pytorch_spiking.modules>_.

If you are interested in building and optimizing spiking neuron models, you may also be interested in NengoDL <https://www.nengo.ai/nengo-dl>. See this page <https://www.nengo.ai/pytorch-spiking/nengo-dl-comparison.html> for a comparison of the different use cases supported by these two packages.

Documentation

Check out the documentation <https://www.nengo.ai/pytorch-spiking/>_ for