Skip to main content

ClikaRT::ops::rand

function

rand()

Tensor rand(
    ClikaRT::Span<const ScalarOrTensor> shape,
    DataType dtype = DataType::Float32,
    StreamOrDevice s = {}
)

Uniform random tensor on [0, 1).

Parameters

  • shape: the output shape (each extent a scalar or 0-D tensor).
  • dtype: output float dtype; default Float32.
  • s: stream or device to allocate/run on; default = the default device.

Returns: a shape-shaped tensor of uniform draws.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) on a non-float dtype.

Declared in ClikaRT/compute/ops.h, line 4076