mindspore.ops.standard_normal ============================= .. image:: https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/br_base/resource/_static/logo_source.svg :target: https://gitee.com/mindspore/mindspore/blob/br_base/docs/api/api_python/ops/mindspore.ops.func_standard_normal.rst :alt: 查看源文件 .. py:function:: mindspore.ops.standard_normal(shape, seed=None) 根据标准正态(高斯)随机数分布生成随机数。 .. math:: f(x)=\frac{1}{\sqrt{2 \pi}} e^{\left(-\frac{x^{2}}{2}\right)} .. warning:: Ascend后端不支持随机数重现功能, `seed` 参数不起作用。 参数: - **shape** (Union[tuple, Tensor]) - 指定生成随机数的shape。 - **seed** (int, 可选) - 随机数种子。默认 ``None`` 。 返回: Tensor 异常: - **ValueError** - `shape` 为tuple时,包含非正的元素。 - **ValueError** - `shape` 为秩不等于1的tensor。