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

This commit is contained in:
luoyuan 2022-11-03 20:17:58 +08:00
parent 0d90568241
commit ecc92b91f8
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)} 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。 - **seed** (int) - 随机种子非负值。默认值0。
- **seed2** (int) - 随机种子2用来防止随机种子冲突非负值。默认值0。 - **seed2** (int) - 随机种子2用来防止随机种子冲突非负值。默认值0。
@ -20,5 +20,6 @@ mindspore.ops.standard_normal
异常: 异常:
- **TypeError** - `seed``seed2` 不是int类型。 - **TypeError** - `seed``seed2` 不是int类型。
- **TypeError** - `shape` 不是Tuple。 - **TypeError** - `shape` 既不是tuple也不是Tensor。
- **ValueError** - `shape` 不是常量值。 - **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)} f(x)=\frac{1}{\sqrt{2 \pi}} e^{\left(-\frac{x^{2}}{2}\right)}
Args: 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. 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. seed2 (int): Random seed2, must be non-negative. A second seed to avoid seed collision. Default: 0.
Returns: 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: Raises:
TypeError: If `seed` or `seed2` is not an int. TypeError: If `seed` or `seed2` is not an int.
TypeError: If `shape` is not a tuple. TypeError: If `shape` is neither a tuple nor a Tensor.
ValueError: If `shape` is not a constant value. ValueError: If `seed` or `seed2` is not a non-negative int.
ValueError: If `shape` is a tuple containing non-positive items.
Supported Platforms: Supported Platforms:
``Ascend`` ``GPU`` ``CPU`` ``Ascend`` ``GPU`` ``CPU``