poisson_interval_online

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

Yields a generator for tensor slices of a spike train with Poisson-sampled 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.

Yields:

torch.Tensor – time slices of the generated spike train.

Shape

inputs:

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

yield:

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

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

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

Important

All elements of inputs must be nonnegative.