Spiking neuron integration for Keras
Project description
Keras Spiking
Keras Spiking provides tools for incorporating spiking neuron activation functions directly within the Keras framework. The main feature is keras_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
inp = tf.keras.Input((5,))
dense = tf.keras.layers.Dense(10)(inp)
act = tf.keras.layers.Activation("relu")(dense)
model = tf.keras.Model(inp, act)
into the spiking equivalent:
# add time dimension to inputs
inp = tf.keras.Input((None, 5))
# use Keras' TimeDistributed wrapper to apply Dense over time
dense = tf.keras.layers.TimeDistributed(tf.keras.layers.Dense(10))(inp)
# replace Activation with SpikingActivation
act = keras_spiking.SpikingActivation("relu")(dense)
model = tf.keras.Model(inp, act)
Models with SpikingActivation layers can be optimized and evaluated in the same way as any other Keras model. They will automatically take advantage of Keras Spiking’s “spiking aware training”: using the spiking activations on the forward pass and the non-spiking (differentiable) activation function on the backwards pass.
Keras Spiking also includes various tools to assist in the training of spiking models, such as additional regularizers and 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
Release history
0.1.0 (August 14, 2020)
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for keras_spiking-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fc108a8542c9f6d22ab4067bd24026ae975442010bd9865e50409797d18e6db |
|
MD5 | 49e30fe39be67ec99b0cb9e3b2792368 |
|
BLAKE2b-256 | fb1c5416911609c41631fa5574ed5915a1ead08a05dc7e4ef5370e1621729881 |