normal#

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

Sample from a normal distribution.

Mirrors numpy.random.normal, including support for tensor parameters and broadcasting.

Parameters#

loc: float | torch.Tensor

Mean of the distribution.

scale: float | torch.Tensor

Standard deviation (must be non-negative).

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

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

Returns#

torch.Tensor

Samples drawn from N(loc, scale^2). Output shape is size + batch_shape, where batch_shape is the broadcasted shape of loc and scale.

Examples#

>>> import deeptrack.backend.array_api_compat_ext.torch.random as rnd
>>> rnd.normal(0.0, 1.0)
tensor(1.5410...)
>>> rnd.normal(0.0, 1.0, (2, 3)).shape
torch.Size([2, 3])