random#
- deeptrack.backend.array_api_compat_ext.torch.random.random(size: tuple[int, ...] | None = None) Tensor#
Sample uniform random numbers in [0, 1).
This function mirrors numpy.random.random, which takes the output shape as a tuple. If size is None, a scalar 0D tensor is returned.
Parameters#
- size: tuple[int, …] | None, optional
Output shape. If None, returns a scalar tensor.
Returns#
- torch.Tensor
A tensor of shape size (or scalar if size is None) with values sampled uniformly from [0, 1).
Examples#
>>> import deeptrack.backend.array_api_compat_ext.torch.random as rnd
>>> rnd.random((2, 3)).shape torch.Size([2, 3])
Scalar sample:
>>> rnd.random() tensor(0.1124)