rand#
- deeptrack.backend.array_api_compat_ext.torch.random.rand(*size: int) Tensor#
Sample uniform random numbers in [0, 1) with a given shape.
This function mirrors numpy.random.rand, i.e., it takes the output shape as positional integer arguments.
Parameters#
- *size: int
Output shape given as positional integers. If empty, returns a scalar 0D tensor.
Returns#
- torch.Tensor
A tensor of shape size (or scalar if size is empty) with values sampled uniformly from [0, 1).
Examples#
>>> import deeptrack.backend.array_api_compat_ext.torch.random as rnd
>>> rnd.rand(2, 3).shape torch.Size([2, 3])
Scalar sample:
>>> rnd.rand() tensor(0.1735)