Function rand

Source
pub fn rand<T: Type>(
    shape: impl Shape,
    dtype: T,
    device: impl AsDevice,
) -> Tensor
Expand description

Creates a Tensor filled with random values from a uniform distribution on the interval [0, 1).

§Arguments

  • shape - The shape of the Tensor.
  • dtype - The data type of the Tensor.
  • device - The device to place the Tensor on.

§Returns

A Tensor filled with random values from a uniform distribution.