InfernoNeuron

class InfernoNeuron(shape: tuple[int, ...] | int, batch_size: int)[source]

Bases: BatchShapeMixin, Neuron

Base class for neurons included in the Inferno library.

Unlike Neuron which only defines an interface, this uses BatchShapeMixin to work with the included mixins to automatically reshape batch-size dependent buffers and parameters.

It also assumes clear() will be implemented so it can be called without arguments and will, by default, not reset state which should persist, such as adaptations.

property batchsz: int

Batch size of the module.

Parameters:

value (int) – new batch size.

Returns:

present batch size.

Return type:

int

clear(**kwargs) None[source]

Resets neurons to their resting state.

Raises:

NotImplementedErrorclear must be implemented by the subclass.

property dt: float

Length of the simulation time step, in milliseconds.

Parameters:

value (float) – new simulation time step length.

Returns:

present simulation time step length.

Return type:

float

Raises:

NotImplementedErrordt must be implemented by the subclass.

forward(inputs: Tensor, **kwargs) Tensor[source]

Runs a simulation step of the neuronal dynamics.

Parameters:

inputs (torch.Tensor) – input currents to the neurons.

Returns:

postsynaptic spikes from integration of inputs.

Return type:

torch.Tensor

Raises:

NotImplementedErrorforward must be implemented by the subclass.

property refrac: Tensor

Remaining refractory periods, in milliseconds.

Parameters:

value (torch.Tensor) – new remaining refractory periods.

Returns:

present remaining refractory periods.

Return type:

torch.Tensor

Raises:

NotImplementedErrorrefrac must be implemented by the subclass.

property spike: Tensor

Action potentials last generated.

Returns:

if the corresponding neuron generated an action potential

during the prior step.

Return type:

torch.Tensor

Raises:

NotImplementedErrorspike must be implemented by the subclass.

property voltage: Tensor

Membrane voltages in millivolts.

Parameters:

value (torch.Tensor) – new membrane voltages.

Returns:

present membrane voltages.

Return type:

torch.Tensor

Raises:

NotImplementedErrorvoltage must be implemented by the subclass.