poisson#

deeptrack.backend.array_api_compat_ext.torch.random.poisson(lam: float | Tensor, size: tuple[int, ...] | None = None) Tensor#

Sample from a Poisson distribution.

Mirrors numpy.random.poisson, including support for tensor parameters and broadcasting. The returned dtype is torch.int64 for NumPy parity.

Parameters#

lam: float | torch.Tensor

Expected number of events (must be non-negative).

size: tuple[int, …] | None, optional

Sample shape. If None, returns scalar or broadcasted tensor.

Returns#

torch.Tensor

Samples drawn from a Poisson distribution (int64). Output shape is size + batch_shape, where batch_shape is the shape of lam.

Examples#

>>> import deeptrack.backend.array_api_compat_ext.torch.random as rnd
>>> rnd.poisson(3.0)
tensor(4)
>>> rnd.poisson(3.0).dtype
torch.int64
>>> rnd.poisson(3.0, (2, 3)).shape
torch.Size([2, 3])