!45097 [MS][OPS] code docs fix standard_normal ops parameter

Merge pull request !45097 from luoyuan/code_docs_fix-standard-normal-ops-para
This commit is contained in:
i-robot 2022-11-04 06:50:58 +00:00 committed by Gitee
commit c136306390
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 10 additions and 7 deletions

View File

@ -11,7 +11,7 @@ mindspore.ops.standard_normal
f(x)=\frac{1}{\sqrt{2 \pi}} e^{\left(-\frac{x^{2}}{2}\right)}
参数:
- **shape** (tuple) - 目标随机数Tensor的shape。只允许常量值
- **shape** (Union[tuple, Tensor]) - 待生成的Tensor的shape。当为tuple类型时只支持常量值当为Tensor类型时支持动态Shape
- **seed** (int) - 随机种子非负值。默认值0。
- **seed2** (int) - 随机种子2用来防止随机种子冲突非负值。默认值0。
@ -20,5 +20,6 @@ mindspore.ops.standard_normal
异常:
- **TypeError** - `seed``seed2` 不是int类型。
- **TypeError** - `shape` 不是Tuple。
- **ValueError** - `shape` 不是常量值。
- **TypeError** - `shape` 既不是tuple也不是Tensor。
- **ValueError** - `seed``seed2` 不是非负的int。
- **ValueError** - `shape` 为tuple时包含非正的元素。

View File

@ -249,17 +249,19 @@ def standard_normal(shape, seed=0, seed2=0):
f(x)=\frac{1}{\sqrt{2 \pi}} e^{\left(-\frac{x^{2}}{2}\right)}
Args:
shape (tuple): The shape of random tensor to be generated. Only constant value is allowed.
shape (Union[tuple, Tensor]): The shape of random tensor to be generated. Only constant value is allowed
when the input type is tuple. And the operator supports dynamic shape only when the input type is Tensor.
seed (int): Random seed, must be non-negative. Default: 0.
seed2 (int): Random seed2, must be non-negative. A second seed to avoid seed collision. Default: 0.
Returns:
Tensor. The shape is the same as the input `shape`. The dtype is float32.
Tensor. The shape that the input 'shape' denotes. The dtype is float32.
Raises:
TypeError: If `seed` or `seed2` is not an int.
TypeError: If `shape` is not a tuple.
ValueError: If `shape` is not a constant value.
TypeError: If `shape` is neither a tuple nor a Tensor.
ValueError: If `seed` or `seed2` is not a non-negative int.
ValueError: If `shape` is a tuple containing non-positive items.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``