Skip to main content

function

randn

randn[type: DType](owned shape: TensorShape, mean: SIMD[float64, 1] = #kgen.float_literal<0|1>, variance: SIMD[float64, 1] = #kgen.float_literal<1|1>) -> Tensor[$0]

Constructs a new Tensor from the shape and fills it with random values from a Normal(mean, variance) distribution.

Constraints:

The type should be floating point.

Parameters:

  • type (DType): The dtype of the pointer.

Args:

  • shape (TensorShape): The shape of the Tensor to fill with random values.
  • mean (SIMD[float64, 1]): Normal distribution mean.
  • variance (SIMD[float64, 1]): Normal distribution variance.

Returns:

A Tensor filled with random dtype samples from Normal(mean, variance).

randn[type: DType](owned spec: TensorSpec, mean: SIMD[float64, 1] = #kgen.float_literal<0|1>, variance: SIMD[float64, 1] = #kgen.float_literal<1|1>) -> Tensor[$0]

Constructs a new Tensor from the spec and fills it with random values from a Normal(mean, variance) distribution.

Constraints:

The type should be floating point.

Parameters:

  • type (DType): The dtype of the pointer.

Args:

  • spec (TensorSpec): The spec of the Tensor to fill with random values.
  • mean (SIMD[float64, 1]): Normal distribution mean.
  • variance (SIMD[float64, 1]): Normal distribution variance.

Returns:

A Tensor filled with random dtype samples from Normal(mean, variance).