qualia_plugin_snn.learningframework.SpikingJelly module

Provide the SpikingJelly single-step learningframework module.

class qualia_plugin_snn.learningframework.SpikingJelly.SpikingJelly[source]

Bases: PyTorch

SpikingJelly single-step LearningFramework implementation extending PyTorch.

qualia_core.learningframework.PyTorch.PyTorch.learningmodels are replaced by the Spiking Neural Networks from qualia_plugin_snn.learningmodel.pytorch

experimenttrackings: ModuleType

qualia_plugin_snn.experimenttracking.pytorch additional experimenttrackings for Spiking Neural Networks.

Merged to qualia_core.learningframework.PyTorch.PyTorch.experimenttrackings.

learningmodels: ModuleType

qualia_plugin_snn.learningmodel.pytorch additional learningmodels for Spiking Neural Networks.

class TrainerModule[source]

Bases: TrainerModule

SpikingJelly single-step TrainerModule implementation extending PyTorch TrainerModule.

model: SNN

Spiking Neural Network model used by this TrainerModule

forward(x: Tensor) Tensor[source]

Forward pass for a Spiking Neural Network model with duplicated timesteps.

First calls SpikingJelly’s reset on the model to reset neurons potentials. Then duplicate the input to generate the number of timesteps given by qualia_plugin_snn.learningmodel.pytorch.SNN.SNN.timesteps Call qualia_plugin_snn.learningmodel.pytorch.SNN.SNN.forward() for each timestep. Finally, average the output of the model over the timesteps.

Parameters:

x (Tensor) – Input data

Returns:

Output predictions

Return type:

Tensor

trace_model(model: Module, extra_custom_layers: tuple[type[Module], ...] = ()) tuple[Graph, GraphModule][source]
Parameters:
Return type:

tuple[Graph, GraphModule]