mindspore.ops.standard_normal
- mindspore.ops.standard_normal(shape, seed=None)[source]
Generates random numbers according to the standard Normal (or Gaussian) random number distribution.
\[f(x)=\frac{1}{\sqrt{2 \pi}} e^{\left(-\frac{x^{2}}{2}\right)}\]Warning
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.
- Parameters
- Returns
Tensor
- Raises
ValueError – If shape is a tuple containing non-positive items.
ValueError – If shape is a Tensor, and the rank of the Tensor is not equal to 1.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> shape = (4, 4) >>> output = mindspore.ops.standard_normal(shape, seed=5) >>> print(f'output shape is {output.shape}') output shape is (4, 4)