norse.torch.functional.poisson_encode

Contents

norse.torch.functional.poisson_encode#

norse.torch.functional.poisson_encode(input_values: Tensor, seq_length: int, f_max: float = 100, dt: float = 0.001, generator: Generator = None) Tensor[source]#

Encodes a tensor of input values, which are assumed to be in the range [0,1] into a tensor of one dimension higher of binary values, which represent input spikes.

See for example https://www.cns.nyu.edu/~david/handouts/poisson.pdf.

Parameters:

input_values (torch.Tensor): Input data tensor with values assumed to be in the interval [0,1]. sequence_length (int): Number of time steps in the resulting spike train. f_max (float): Maximal frequency (in Hertz) which will be emitted. dt (float): Integration time step (should coincide with the integration time step used in the model) generator (torch.Generator): Generator for pseudorandom numbers. Usually, generator.manual_seed(seed value) is passed as the argument

Returns:

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