.. _op_ai_onnx_RandomUniform: RandomUniform ============= - **Domain**: ``ai.onnx`` - **Since version**: 22 Generate a tensor with random values drawn from a uniform distribution. The shape of the tensor is specified by the ``shape`` argument and the range by ``low`` and ``high``. The data type is specified by the 'dtype' argument. The 'dtype' argument must be one of the data types specified in the 'DataType' enum field in the TensorProto message. **Outputs** - **output** (*T*): Output tensor of random values drawn from uniform distribution **Attributes** - **dtype** (*int*): The data type for the elements of the output tensor. If not specified, default is TensorProto::FLOAT. - **high** (*float*): Upper boundary of the output values. - **low** (*float*): Lower boundary of the output values. - **seed** (*float*): (Optional) Seed to the random generator, if not specified we will auto generate one. - **shape** (*int[]*): The shape of the output tensor. **Type Constraints** - **T**: Constrain output types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16). Examples -------- **test_cc_randomuniform** .. code-block:: text Node: RandomUniform() -> (y) Attributes: shape = [2, 3] .. code-block:: text Inputs: Outputs: y: shape=(2, 3), dtype=float32 [[0.8833108 , 0.431528 , 0.02643377], [0.970882 , 0.10634669, 0.32732576]] **test_cc_randomuniform_double** .. code-block:: text Node: RandomUniform() -> (y) Attributes: dtype = 11 shape = [2, 3] .. code-block:: text Inputs: Outputs: y: shape=(2, 3), dtype=float64 [[0.88331081, 0.431528 , 0.02643377], [0.97088198, 0.10634669, 0.32732576]] **test_cc_randomuniform_seeded** .. code-block:: text Node: RandomUniform() -> (y) Attributes: low = -1.0 high = 3.0 seed = 42.0 shape = [2, 3] .. code-block:: text Inputs: Outputs: y: shape=(2, 3), dtype=float32 [[ 1.9662595 , -0.36035842, 0.11440456], [ 0.37676287, -0.8478793 , 2.4729123 ]] Differences with previous version (1) ------------------------------------- **SchemaDiff**: ``RandomUniform`` (domain ``'ai.onnx'``) * old version: 1 * new version: 22 * breaking: no **Type constraints:** * changed 'T': added types: ['tensor(bfloat16)'] Version History --------------- - :doc:`Version 1 `