mindspore.ops.UniformReal

class mindspore.ops.UniformReal(seed=0, seed2=0)[source]

Produces random floating-point values i, uniformly distributed to the interval [0, 1).

Parameters
  • seed (int) – Random seed, must be non-negative. Default: 0.

  • seed2 (int) – Random seed2, must be non-negative. Default: 0.

Inputs:
  • shape (tuple) - The shape of random 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 neither seed nor seed2 is 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)