fn
rand_op
→TensorImplPtrint rand_op(const int & shape, Dtype dt, Device device, Generator * gen)Python wrappers
Public Python APIs implemented by this engine symbol.Allocates a tensor filled with uniform samples on .
Convenience wrapper around uniform_op with
low = 0 / high = 1.
Math
See Also
uniform_op — arbitrary interval.
randn_op — Gaussian variant.
Parameters
shapeconst Shape&Shape of the output tensor.
dtDtypeElement dtype. Floating-point dtypes only (
F32, F64, BF16, F16).deviceDeviceMemory domain of the output (
CPU or GPU).Bit-stream state to draw from. When
nullptr (the default), uses default_generator.Returns
TensorImplPtrNewly allocated leaf tensor (requires_grad = false) of the requested shape / dtype / device.