homogeneous_poisson_exp_interval_online¶
- homogeneous_poisson_exp_interval_online(inputs: Tensor, steps: int, step_time: float, *, refrac: float | None = None, compensate: bool = True, generator: Generator | None = None) Iterator[Tensor][source]¶
Yields a generator for tensor slices of a Poisson spike train.
This method samples randomly from an exponential distribution (the interval between samples in a Poisson point process), adding an additional refractory period and compensating the rate.
- Parameters:
inputs (torch.Tensor) – expected spike frequencies, \(f\), in \(\text{Hz}\).
steps (int) – number of steps for which to generate spikes, \(S\).
step_time (float) – length of time between outputs, \(\Delta t\), in \(\text{ms}\).
refrac (float | None, optional) – minimum interval between spikes set to the step time if
None, in \(\text{ms}\). Defaults toNone.compensate (bool, optional) – if the spike generation rate should be compensate for the refractory period. Defaults to
True.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.
Caution
If the refractory period is greater than or equal to the expected intervals between spikes, output will be nonsensical. The expected intervals are equal to \(1000 \frac{1}{f} \text{ ms}\).
Important
All elements of
inputsmust be nonnegative.Note
refracat its default still allows for a spike to be generated at every step (since the distance between is \(\Delta t\)). To get behavior where at most every \(n^\text{th}\) step is a spike, the refractory period needs to be set to \(n \Delta t\).