qualia_plugin_snn.learningframework.SpikingJellyMultiStep module

Provide the SpikingJellyMultiStep learningframework module.

class qualia_plugin_snn.learningframework.SpikingJellyMultiStep.SpikingJellyMultiStep[source]

Bases: SpikingJelly

SpikingJelly multi-step LearningFramework implementation extending SpikingJelly single-step.

class TrainerModule[source]

Bases: TrainerModule

SpikingJelly multi-step TrainerModule implementation extending SpikingJelly single-step TrainerModule.

forward(x: Tensor) Tensor[source]

Forward pass for a Spiking Neural Network model with duplicated timesteps in multi-step mode.

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. Timesteps are generated as a new dimension of the input tensor: [N, C, …] → [T, N, C, …] Call qualia_plugin_snn.learningmodel.pytorch.SNN.SNN.forward() for the whole tensor. Finally, average the output of the model over the timestep dimension.

Parameters:

x (Tensor) – Input data

Returns:

Output predictions

Return type:

Tensor