nki.isa.rand2#
- nki.isa.rand2(dst, min, max, name=None)[source]#
Generate pseudo random numbers with uniform distribution using Vector Engine.
Note
Available only on NeuronCore-v4 and newer.
This instruction generates pseudo random numbers and stores them into SBUF/PSUM. The generated values follow a uniform distribution within the specified [min, max] range.
Key features:
Uses XORWOW PRNG algorithm for high-quality random number generation
Generates FP32 random values with uniform distribution
Supports output conversion to various data types
Memory types.
The output
dsttile can be in SBUF or PSUM.Data types.
The output
dsttile can be any of: float8_e4m3, float8_e5m2, float16, bfloat16, float32, tfloat32, int8, int16, int32, uint8, uint16, or uint32.Tile size.
The partition dimension size of
dstmust not exceed 128. The number of elements per partition ofdstmust not exceed the physical size of each SBUF/PSUM partition.Constraints.
Supported arch versions: NeuronCore-v4+.
Supported engines: Vector.
min < max for valid range.
- Parameters:
dst – the destination tensor to write random values to
min – minimum value for uniform distribution range (FP32), can be a scalar or vector value
max – maximum value for uniform distribution range (FP32), can be a scalar or vector value