Fully Connected block class#

Fully Connected Spiking block class#

class src.model.SpikingBlock.SpikingFCBlock(input_dim: int, output_dim: int, nb_steps: int, truncated_bptt_ratio: int, spike_fn: SuperSpike | SigmoidDerivative | PiecewiseLinear | ATan, neuron_model: str, neuron_parameters: dict, weight_init: dict, scale_flag: bool, scale_factor: float, bn_flag: bool, dropout_flag: bool, dropout_p: float, device, dtype: dtype, layer_index: int)#

Bases: Module

Class that implements the SNN spiking linear block.

forward(x: Tensor)#

Method that defines the performed computation during the forward pass.

Note

Note that this method override the super class method.

Parameters:

x (torch.Tensor) -- A tensor of input data.

init_neuron_parameters(neuron_parameters: dict)#

Method that handles the spiking neurons parameters' initialization.

Parameters:

neuron_parameters (dict) -- Initialization specifications' dictionary.

init_recurrent_weights(weight_init: dict)#

Method that handles the recurrent parameters' initialization.

Parameters:

weight_init (dict) -- Initialization specifications' dictionary.

init_weights(weight_init: dict)#

Method that handles the linear parameters' initialization.

Parameters:

weight_init (dict) -- Initialization specifications' dictionary.

training: bool#

Fully Connected Readout block class#

class src.model.SpikingBlock.ReadoutFCBlock(input_dim: int, output_dim: int, nb_steps: int, truncated_bptt_ratio: int, spike_fn: SuperSpike | SigmoidDerivative | PiecewiseLinear | ATan, neuron_model: str, neuron_parameters: dict, weight_init: dict, scale_flag: bool, scale_factor: float, device, dtype: dtype, layer_index: int)#

Bases: Module

Class that implements the SNN readout linear block.

forward(x: Tensor)#

Method that defines the performed computation during the forward pass.

Note

Note that this method override the super class method.

Parameters:

x (torch.Tensor) -- A tensor of input data.

init_neuron_parameters(neuron_parameters: dict)#

Method that handles the readout neurons parameters' initialization.

Parameters:

neuron_parameters (dict) -- Initialization specifications' dictionary.

init_weights(weight_init: dict)#

Method that handles the linear parameters' initialization.

Parameters:

weight_init (dict) -- Initialization specifications' dictionary.

training: bool#