Skip to main content

ClikaRT::ops::randn

function

randn()

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

Standard-normal random tensor, N(0, 1).

xN(0,1)x \sim \mathcal{N}(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; default = the default device.

Returns: a shape-shaped tensor of normal draws.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) on a non-float dtype.
auto noise = ClikaRT::ops::randn({batch, dim});

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