Mojo function
randn
randn[type: DType](ptr: UnsafePointer[SIMD[type, 1], 0, 0, alignof[::AnyType,__mlir_type.!kgen.target]() if triple_is_nvidia_cuda() else 1], size: Int, mean: SIMD[float64, 1] = #kgen.float_literal<0|1>, variance: SIMD[float64, 1] = #kgen.float_literal<1|1>)
Fills memory 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:
- ptr (
UnsafePointer[SIMD[type, 1], 0, 0, alignof[::AnyType,__mlir_type.!kgen.target]() if triple_is_nvidia_cuda() else 1]
): The pointer to the memory area to fill. - size (
Int
): The number of elements to fill. - mean (
SIMD[float64, 1]
): Normal distribution mean. - variance (
SIMD[float64, 1]
): Normal distribution variance.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
😔 What went wrong?