!42128 modify format

Merge pull request !42128 from 俞涵/code_docs_0819
This commit is contained in:
i-robot 2022-09-16 04:38:36 +00:00 committed by Gitee
commit 66ba9e952b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 38 additions and 56 deletions

View File

@ -647,4 +647,5 @@ Parameter操作函数
mindspore.ops.arange
mindspore.ops.core
mindspore.ops.count_nonzero
mindspore.ops.iou

View File

@ -5,22 +5,4 @@
Dropout是一种正则化手段通过在训练中以 :math:`1 - keep\_prob` 的概率随机将神经元输出设置为0起到减少神经元相关性的作用避免过拟合。
参数:
- **keep_prob** (float) - 输入神经元保留概率数值范围在0到1之间。例如keep_prob=0.9删除10%的神经元。默认值0.5。
- **Seed0** (int) - 算子层的随机种子用于生成随机数。默认值0。
- **Seed1** (int) - 全局的随机种子和算子层的随机种子共同决定最终生成的随机数。默认值0。
输入:
- **x** (Tensor) - Dropout的输入任意维度的Tensor其数据类型为float16或float32。
输出:
- **output** (Tensor) - shape和数据类型与 `x` 相同。
- **mask** (Tensor) - shape与 `x` 相同。
异常:
- **TypeError** - `keep_prob` 不是float。
- **TypeError** - `Seed0``Seed1` 不是int。
- **TypeError** - `x` 的数据类型既不是float16也不是float32。
- **TypeError** - `x` 不是Tensor。
更多细节请参考 :func:`mindspore.ops.dropout`

View File

@ -1,7 +1,7 @@
mindspore.ops.relu
==================
.. py:function:: mindspore.ops.relu(input_x)
.. py:function:: mindspore.ops.relu(x)
线性修正单元激活函数Rectified Linear Unit
@ -14,12 +14,12 @@ mindspore.ops.relu
一般来说,与 `ReLUV2` 相比,此算子更常用。且 `ReLUV2` 会多输出一个掩码。
参数:
- **input_x** (Tensor) - relu的输入shape :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度,
- **x** (Tensor) - relu的输入shape :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度,
其数据类型为 `number <https://www.mindspore.cn/docs/en/master/api_python/mindspore.html#mindspore.dtype>`_
返回:
Tensor数据类型和shape与 `input_x` 相同。
Tensor数据类型和shape与 `x` 相同。
异常:
- **TypeError** - `input_x` 的数据类型不是数值型。
- **TypeError** - `input_x` 不是Tensor。
- **TypeError** - `x` 的数据类型不是数值型。
- **TypeError** - `x` 不是Tensor。

View File

@ -1,7 +1,7 @@
mindspore.ops.relu6
====================
.. py:function:: mindspore.ops.relu6(input_x)
.. py:function:: mindspore.ops.relu6(x)
计算输入Tensor的ReLU修正线性单元其上限为6。
@ -11,11 +11,11 @@
返回 :math:`\min(\max(0,x), 6)` 元素的值。
参数:
- **input_x** (Tensor) - relu6的输入shape :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度数据类型为float16或float32。
- **x** (Tensor) - relu6的输入shape :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度数据类型为float16或float32。
返回:
Tensor数据类型和shape与 `input_x` 相同。
Tensor数据类型和shape与 `x` 相同。
异常:
- **TypeError** - 如果 `input_x` 的数据类型既不是float16也不是float32。
- **TypeError** - 如果 `input_x` 不是Tensor。
- **TypeError** - 如果 `x` 的数据类型既不是float16也不是float32。
- **TypeError** - 如果 `x` 不是Tensor。

View File

@ -95,6 +95,7 @@ Activation Functions
:template: classtemplate.rst
mindspore.ops.celu
mindspore.ops.dropout
mindspore.ops.fast_gelu
mindspore.ops.gumbel_softmax
mindspore.ops.hardshrink
@ -643,8 +644,6 @@ Other Functions
- Determine if two strings are equal.
* - mindspore.ops.typeof
- Get type of object.
* - mindspore.ops.iou
- Computes the intersection over union (IOU) or the intersection over foreground (IOF) for boxes.-
.. msplatformautosummary::
:toctree: ops
@ -652,6 +651,6 @@ Other Functions
:template: classtemplate.rst
mindspore.ops.arange
mindspore.ops.batch_dot
mindspore.ops.core
mindspore.ops.count_nonzero
mindspore.ops.iou

View File

@ -5829,13 +5829,13 @@ def iou(anchor_boxes, gt_boxes, mode='iou'):
and width are scaled by 0.2 internally.
Args:
- **anchor_boxes** (Tensor) - Anchor boxes, tensor of shape (N, 4). "N" indicates the number of anchor boxes,
and the value "4" refers to "x0", "y0", "x1", and "y1". Data type must be float16 or float32.
- **gt_boxes** (Tensor) - Ground truth boxes, tensor of shape (M, 4). "M" indicates the number of ground
truth boxes, and the value "4" refers to "x0", "y0", "x1", and "y1". Data type must be float16 or float32.
- **mode** (string): The mode is used to specify the calculation method,
now supporting 'iou' (intersection over union) or 'iof' (intersection over foreground) mode.
Default: 'iou'.
anchor_boxes (Tensor): Anchor boxes, tensor of shape (N, 4). "N" indicates the number of anchor boxes,
and the value "4" refers to "x0", "y0", "x1", and "y1". Data type must be float16 or float32.
gt_boxes (Tensor): Ground truth boxes, tensor of shape (M, 4). "M" indicates the number of ground
truth boxes, and the value "4" refers to "x0", "y0", "x1", and "y1". Data type must be float16 or float32.
mode (string): The mode is used to specify the calculation method,
now supporting 'iou' (intersection over union) or 'iof' (intersection over foreground) mode.
Default: 'iou'.
Returns:
Tensor, the 'iou' values, tensor of shape (M, N), with the same data type as `anchor_boxes`.

View File

@ -1614,11 +1614,11 @@ def relu(x):
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore.html#mindspore.dtype>`_.
Returns:
Tensor of shape :math:`(N, *)`, with the same dtype and shape as the `input_x`.
Tensor of shape :math:`(N, *)`, with the same dtype and shape as the `x`.
Raises:
TypeError: If dtype of `input_x` is not a number.
TypeError: If `input_x` is not a Tensor.
TypeError: If dtype of `x` is not a number.
TypeError: If `x` is not a Tensor.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``
@ -1645,15 +1645,15 @@ def relu6(x):
It returns :math:`\min(\max(0,x), 6)` element-wise.
Args:
x(Tensor) - Tensor of shape :math:`(N, *)`, where :math:`*` means, any number of
x (Tensor): Tensor of shape :math:`(N, *)`, where :math:`*` means, any number of
additional dimensions, with float16 or float32 data type.
Returns:
Tensor, with the same dtype and shape as the `input_x`.
Tensor, with the same dtype and shape as the `x`.
Raises:
TypeError: If dtype of `input_x` is neither float16 nor float32.
TypeError: If `input_x` is not a Tensor.
TypeError: If dtype of `x` is neither float16 nor float32.
TypeError: If `x` is not a Tensor.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``
@ -2903,19 +2903,19 @@ def batch_norm(input_x, running_mean, running_var, weight, bias, training=False,
Args:
If `training` is False, `scale`, `bias`, `mean` and `variance` are Tensors.
input_x (Tensor) - Tensor of shape :math:`(N, C)`, with float16 or float32 data type.
running_mean (Tensor) - Tensor of shape :math:`(C,)`, has the same data type with `scale`.
running_var (Tensor) - Tensor of shape :math:`(C,)`, has the same data type with `scale`.
weight (Tensor) - Tensor of shape :math:`(C,)`, with float16 or float32 data type.
bias (Tensor) - Tensor of shape :math:`(C,)`, has the same data type with `scale`.
input_x (Tensor): Tensor of shape :math:`(N, C)`, with float16 or float32 data type.
running_mean (Tensor): Tensor of shape :math:`(C,)`, has the same data type with `scale`.
running_var (Tensor): Tensor of shape :math:`(C,)`, has the same data type with `scale`.
weight (Tensor): Tensor of shape :math:`(C,)`, with float16 or float32 data type.
bias (Tensor): Tensor of shape :math:`(C,)`, has the same data type with `scale`.
If `training` is True, `scale`, `bias`, `mean` and `variance` are Parameters.
input_x (Tensor) - Tensor of shape :math:`(N, C)`, with float16 or float32 data type.
running_mean (Parameter) - Parameter of shape :math:`(C,)`, has the same data type with `scale`.
running_var (Parameter) - Parameter of shape :math:`(C,)`, has the same data type with `scale`.
weight (Parameter) - Parameter of shape :math:`(C,)`, with float16 or float32 data type.
bias (Parameter) - Parameter of shape :math:`(C,)`, has the same data type with `scale`.
input_x (Tensor): Tensor of shape :math:`(N, C)`, with float16 or float32 data type.
running_mean (Parameter): Parameter of shape :math:`(C,)`, has the same data type with `scale`.
running_var (Parameter): Parameter of shape :math:`(C,)`, has the same data type with `scale`.
weight (Parameter): Parameter of shape :math:`(C,)`, with float16 or float32 data type.
bias (Parameter): Parameter of shape :math:`(C,)`, has the same data type with `scale`.
training (bool): If `training` is True, `mean` and `variance` are computed during training.
If `training` is False, they're loaded from checkpoint during inference. Default: False.
@ -2925,7 +2925,7 @@ def batch_norm(input_x, running_mean, running_var, weight, bias, training=False,
eps (float): A small value added for numerical stability. Default: 1e-5.
Returns:
output_x (Tensor) - The same type and shape as the input_x. The shape is :math:`(N, C)`.
output_x (Tensor), The same type and shape as the input_x. The shape is :math:`(N, C)`.
Raises:
TypeError: If `training` is not a bool.