mindspore.ops.randn

View Source On Gitee
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

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. Default None .

  • seed (int, optional) – Random seed, must be non-negative. Default None .

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> print(mindspore.ops.randn((2, 2)))
[[ 0.30639967 -0.42438635]
 [-0.4287376   1.3054721 ]]