mindspore.ops.StandardNormal

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

Generates random numbers according to the standard Normal (or Gaussian) random number distribution.

Refer to mindspore.ops.standard_normal() for more details.

Note

  • Random seed: a set of regular random numbers can be obtained through some complex mathematical algorithms, and the random seed determines the initial value of this random number. If the random seed is the same in two separate calls, the random number generated will not change.

  • Using the Philox algorithm to scramble seed and seed2 to obtain random seed so that the user doesn’t need to worry about which seed is more important.

Parameters
  • seed (int, optional) – The operator-level random seed, used to generate random numbers, must be non-negative. Default: 0 .

  • seed2 (int, optional) – The global random seed, which combines with the operator-level random seed to determine the final generated random number, must be non-negative. Default: 0 .

Inputs:
  • shape (tuple) - The shape of random tensor to be generated. Only constant value is allowed. Supported dtypes: int32, int64.

Outputs:

Tensor. The shape is the same as the input shape. The dtype is float32.

Supported Platforms:

Ascend GPU CPU

Examples

>>> from mindspore import ops
>>> shape = (3, 4)
>>> stdnormal = ops.StandardNormal(seed=2)
>>> output = stdnormal(shape)
>>> print(output)
[[-1.3031056   0.64198005 -0.65207404 -1.767485  ]
 [-0.91792876  0.6508565  -0.9098478  -0.14092612]
 [ 0.7806437   1.1585592   1.9676613  -0.00440959]]