Neuron model layer class#
Spiking neuron model layer class#
- class src.model.SpikingLayer.NeuronModel(truncated_bptt_ratio: int, spike_fn: Callable, reset_mode: str, detach_reset: bool, decay_input: bool, device, dtype)#
Bases:
Module
Class that implements spiking neurons layer.
- clamp_neuron_parameters()#
Method that handles the spiking neurons parameters tensors' clamp.
- forward(input_: Tensor) Tuple[Tensor, Tensor] #
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- init_neuron_parameters(neuron_parameters: dict, lif_std: float = 0.01, lif_bound: float = 0.01)#
Method that handles the spiking neurons parameters' initialization.
- Parameters:
neuron_parameters (dict) -- Neuron model specifications' dictionary.
lif_std (float) -- Initialization parameter.
lif_bound (float) -- Initialization parameter.
- multi_step_neuron(input_: Tensor) Tuple[Tensor, Tensor | List] #
- reset_neuron(new_membrane_potential: Tensor, reset: Tensor)#
Method that handles the spiking neurons membrane potential reset.
- Parameters:
new_membrane_potential (torch.Tensor) -- New membrane potential tensor.
reset (torch.Tensor) -- Reset tensor.
- property save_mem#
- training: bool#
Non Spiking neuron model layer class#
- class src.model.SpikingLayer.MPNeuronModel(truncated_bptt_ratio: int, decay_input: bool, device, dtype)#
Bases:
Module
Class that implements non-spiking neurons layer.
- clamp_neuron_parameters()#
Method that handles the non-spiking neurons parameters tensors' clamp.
- forward(input_: Tensor)#
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- init_neuron_parameters(neuron_parameters: dict, lif_std: float = 0.01, lif_bound: float = 0.01)#
Method that handles the non-spiking neurons parameters' initialization.
- Parameters:
neuron_parameters (dict) -- Neuron model specifications' dictionary.
lif_std (float) -- Initialization parameter.
lif_bound (float) -- Initialization parameter.
- multi_step_LI(input_: Tensor) Tuple[Tensor] #
- training: bool#