mindspore.ops.UniformReal
- class mindspore.ops.UniformReal(seed=0, seed2=0)[source]
Produces random floating-point values, uniformly distributed to the interval [0, 1).
- Parameters
Note
Global random seed and operator-level random seed are not set: Use the default value as the random seed.
Global random seed is set, but operator-level random seed is not set: A global random seed will splice with a randomly generated seed.
Global random seed is not set, operator-level random seed is set: The default global random seed is used, and splices with the operator-level random seed.
Both Global random and operator-level random seed are set: The global random seed will splice with the operator-level random seed.
- Inputs:
shape (tuple) - The shape of tensor to be generated. Only constant value is allowed.
- Outputs:
Tensor. The shape that the input ‘shape’ denotes. The dtype is float32.
- Raises
TypeError – If seed or seed2 is not an int.
TypeError – If shape is not a tuple.
ValueError – If shape is not a constant value.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> shape = (2, 2) >>> uniformreal = ops.UniformReal(seed=2) >>> output = uniformreal(shape) >>> result = output.shape >>> print(result) (2, 2)