norse.torch.functional.constant_current_lif_encode

norse.torch.functional.constant_current_lif_encode#

norse.torch.functional.constant_current_lif_encode(input_current: Tensor, seq_length: int, p: LIFParameters = (tensor(200.), tensor(100.), tensor(0.), tensor(1.), tensor(0.), 'super', tensor(100.)), dt: float = 0.001) Tensor[source]#

Encodes input currents as fixed (constant) voltage currents, and simulates the spikes that occur during a number of timesteps/iterations (seq_length).

Example:
>>> data = torch.as_tensor([2, 4, 8, 16])
>>> seq_length = 2 # Simulate two iterations
>>> constant_current_lif_encode(data, seq_length)
 # State in terms of membrane voltage
(tensor([[0.2000, 0.4000, 0.8000, 0.0000],
         [0.3800, 0.7600, 0.0000, 0.0000]]),
 # Spikes for each iteration
 tensor([[0., 0., 0., 1.],
         [0., 0., 1., 1.]]))
Parameters:

input_current (torch.Tensor): The input tensor, representing LIF current seq_length (int): The number of iterations to simulate p (LIFParameters): Initial neuron parameters. dt (float): Time delta between simulation steps

Returns:

A tensor with an extra dimension of size seq_length containing spikes (1) or no spikes (0).