poisson_interval

poisson_interval(inputs: Tensor, steps: int, step_time: float, *, generator: Generator | None = None) Tensor[source]

Generates a tensor of spikes with Poisson determined intervals.

This is included to replicate BindsNET’s Poisson spike generation. The intervals between spikes follow the Poisson distribution parameterized with the inverse of the expected rate (i.e. the scale is given as the rate).

Parameters:
  • inputs (torch.Tensor) – expected spike frequencies, in \(\text{Hz}\).

  • steps (int) – number of steps for which to generate spikes, \(S\).

  • step_time (float) – length of time between outputs, in \(\text{ms}\).

  • generator (torch.Generator | None, optional) – pseudorandom number generator for sampling. Defaults to None.

Returns:

the generated spike train, time first.

Return type:

torch.Tensor

Shape

inputs:

\(B \times N_0 \times \cdots\)

return:

\(S \times B \times N_0 \times \cdots\)

Where:
  • \(B\) is the batch size.

  • \(N_0, \ldots\) are the dimensions of the spikes being generated.

  • \(S\) is the number of steps for which to generate spikes, steps.

Important

All elements of inputs must be nonnegative.