mindspore/docs/api/api_python/ops/mindspore.ops.TruncatedNorm...

32 lines
1.4 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.TruncatedNormal
==============================
.. py:class:: mindspore.ops.TruncatedNormal(seed=0, seed2=0, dtype=mstype.float32)
返回一个具有指定shape的Tensor其数值取自正态分布。
生成的值符合正态分布。
.. warning::
`shape` 所含元素的值必须大于零。输出长度必须不超过1000000。
参数:
- **seed** (int可选) - 随机数种子。如果 `seed` 或者 `seed2` 被设置为非零则使用这个非零值。否则使用一个随机生成的种子。默认值0。
- **seed2** (int可选) - 另一个随机种子避免发生冲突。默认值0。
- **dtype** (mindspore.dtype可选) - 指定输出类型。可选值为mindspore.float16、mindspore.float32和mindspore.float64。默认值mindspore.float32。
输入:
- **shape** (Tensor) - 生成Tensor的shape。数据类型必须是mindspore.int32或者mindspore.int64。
输出:
Tensor其shape由 `shape` 决定,数据类型由 `dtype` 决定。其值在[-2,2]范围内。
异常:
- **TypeError** - `shape` 不是Tensor。
- **TypeError** - `dtype``shape` 的数据类型不支持。
- **TypeError** - `seed` 不是整数。
- **ValueError** - `shape` 的元素不全大于零。
- **ValueError** - `shape` 不是一维Tensor。
- **ValueError** - 输出Tensor的元素个数大于1000000。