Mojo function
random_normal
random_normal[dtype: DType, rank: Int, //, output_fn: def[width: Int, _rank: Int](idx: IndexList[_rank], val: SIMD[dtype, width]) capturing -> None, target: StringSlice[StaticConstantOrigin]](shape: IndexList[rank], mean: Float32, stddev: Float32, seed_ptr: UnsafePointer[UInt64, ImmutAnyOrigin], ctx: DeviceContextPtr)
Call output_fn with values generated from a normal distribution with the specified mean and standard deviation.
Parameters:
- βdtype (
DType): The data type to generate. - βrank (
Int): The rank of the underlying buffer. - βoutput_fn (
def[width: Int, _rank: Int](idx: IndexList[_rank], val: SIMD[dtype, width]) capturing -> None): The function which stores the generated values. - βtarget (
StringSlice[StaticConstantOrigin]): The target to run on.
Args:
- βshape (
IndexList[rank]): The shape of the output being stored into by output_fn. - βmean (
Float32): The mean of the normal distribution. - βstddev (
Float32): The standard deviation of the normal distribution. - βseed_ptr (
UnsafePointer[UInt64, ImmutAnyOrigin]): Pointer to a single uint64 in device memory containing the Philox seed. - βctx (
DeviceContextPtr): The device context.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!