mindspore.ops.randn
- mindspore.ops.randn(*size, dtype=None, seed=None)[source]
Return a new tensor with given shape and dtype, filled with random numbers from the standard normal distribution.
Warning
Non-backward-compatible change after version 2.9.0: parameter seed will be removed, parameter generator will be added, and the *size form will be adjusted to size.
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.
- Parameters
size (Union[int, tuple(int), list(int)]) – Shape of the output tensor.
- Keyword Arguments
dtype (
mindspore.dtype, optional) – The data type returned. DefaultNone.seed (int, optional) – Random seed, must be non-negative. Default
None.
- Returns
Tensor
- Supported Platforms:
AscendGPUCPU
Examples
>>> import mindspore >>> print(mindspore.ops.randn((2, 2))) [[ 0.30639967 -0.42438635] [-0.4287376 1.3054721 ]]