mindspore.ops.randn_like
- mindspore.ops.randn_like(input, seed=None, *, dtype=None)[source]
Return a tensor with the same shape as input, filled with random numbers from the standard normal distribution.
Warning
Non-backward-compatible change after version 2.9.0: seed will be removed, and generator and device parameters will be added.
The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.
- Parameters
- Keyword Arguments
dtype (
mindspore.dtype, optional) – The data type returned. DefaultNone.- Returns
Tensor
- Supported Platforms:
AscendGPUCPU
Examples
>>> import mindspore >>> a = mindspore.tensor([[1, 2, 3], [4, 5, 6]]) >>> print(mindspore.ops.randn_like(a, dtype=mindspore.float32)) [[ 0.30639967 -0.42438635 -0.20454668] [-0.4287376 1.3054721 0.64747655]]