norse.torch.functional.constant_current_lif_encode

norse.torch.functional.constant_current_lif_encode(input_current: torch.Tensor, seq_length: int, p: norse.torch.functional.lif.LIFParameters = LIFParameters(tau_syn_inv=tensor(200.), tau_mem_inv=tensor(100.), v_leak=tensor(0.), v_th=tensor(1.), v_reset=tensor(0.), method='super', alpha=tensor(100.)), dt: float = 0.001)torch.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).