!39883 fix avgpool docs

Merge pull request !39883 from 范吉斌/code_docs_avg_pool
This commit is contained in:
i-robot 2022-08-08 06:30:27 +00:00 committed by Gitee
commit ab7e20c870
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 11 additions and 24 deletions

View File

@ -5,23 +5,14 @@ mindspore.ops.AvgPool
对输入的多维数据进行二维平均池化运算。
一般地,输入的形状为 :math:`(N_{in}, C_{in}, H_{in}, W_{in})` AvgPool输出 :math:`(H_{in}, W_{in})` 维度的区域平均值。给定 `kernel_size`:math:`(kH, kW)``stride` ,运算如下:
.. math::
\text{output}(N_i, C_j, h, w) = \frac{1}{kH * kW} \sum_{m=0}^{kH-1} \sum_{n=0}^{kW-1}
\text{input}(N_i, C_j, stride[0] \times h + m, stride[1] \times w + n)
.. warning::
- 支持全局池化。
- 在Ascend上"kernel_size"的高度和宽度取值为[1, 255]范围内的正整数。 其高度和宽度相乘小于256。
- 由于指令限制,"strides"的取值为[1, 63]范围内的正整数。
更多参考详见 :func:`mindspore.ops.avg_pool2d`
参数:
- **kernel_size** (Union[int, tuple[int]]) - 指定池化核尺寸大小可以是单个整数表示池化核高度和宽度或者整数tuple分别表示池化核高度和宽度。默认值1。
- **strides** (Union[int, tuple[int]]) - 池化操作的移动步长可以是单个整数表示高度和宽度方向的移动步长或者整数tuple分别表示高度和宽度方向的移动步长。默认值1。
- **pad_mode** (str) - 指定池化填充模式,取值为"same"或"valid",不区分大小写。默认值:"valid"。
- **same** - 输出的高度和宽度分别与输入整除 `stride` 后的值相同。
- **same** - 输出的高度和宽度分别与输入向上整除 `stride` 后的值相同。
- **valid** - 在不填充的前提下返回有效计算所得的输出。不满足计算的多余像素会被丢弃。
- **data_format** (str) - 指定输入和输出的数据格式。取值为'NHWC'或'NCHW'。默认值:'NCHW'。

View File

@ -22,7 +22,7 @@ mindspore.ops.avg_pool2d
- **strides** (Union[int, tuple[int]]) - 池化操作的移动步长可以是单个整数表示高度和宽度方向的移动步长或者整数tuple分别表示高度和宽度方向的移动步长。默认值1。
- **pad_mode** (str) - 指定池化填充模式,取值为'same'或'valid',不区分大小写。默认值:'valid'。
- **same** - 输出的高度和宽度分别与输入整除 `strides` 后的值相同。
- **same** - 输出的高度和宽度分别与输入向上整除 `strides` 后的值相同。
- **valid** - 在不填充的前提下返回有效计算所得的输出。不满足计算的多余像素会被丢弃。
- **data_format** (str) - 指定输入和输出的数据格式。取值为'NHWC'或'NCHW'。默认值:'NCHW'。

View File

@ -157,13 +157,11 @@ def avg_pool2d(x, kernel_size=1, strides=1, pad_mode='valid', data_format='NCHW'
pad_mode (str): The optional value for pad mode, is 'same' or 'valid'.
Default: 'valid'.
- same: Adopts the way of completion. The height and width of the output will be the same as
the input. The total number of padding will be calculated in horizontal and vertical
directions and evenly distributed to top and bottom, left and right if possible.
Otherwise, the last extra padding will be done from the bottom and the right side.
- same: The height and width of the output are the same as the input divided by 'strides'
and rounded up.
- valid: Adopts the way of discarding. The possible largest height and width of output
will be returned without padding. Extra pixels will be discarded.
- valid: Returns the output of the valid calculation without filling. Redundant pixels that
do not satisfy the calculation will be discarded.
data_format (str): The format of input and output data. It should be 'NHWC' or 'NCHW'.
Default: 'NCHW'.

View File

@ -2261,13 +2261,11 @@ class AvgPool(_Pool):
pad_mode (str): The optional value for pad mode, is 'same' or 'valid'.
Default: 'valid'.
- same: Adopts the way of completion. The height and width of the output will be the same as
the input. The total number of padding will be calculated in horizontal and vertical
directions and evenly distributed to top and bottom, left and right if possible.
Otherwise, the last extra padding will be done from the bottom and the right side.
- same: The height and width of the output are the same as the input divided by 'strides'
and rounded up.
- valid: Adopts the way of discarding. The possible largest height and width of output
will be returned without padding. Extra pixels will be discarded.
- valid: Returns the output of the valid calculation without filling. Redundant pixels that
do not satisfy the calculation will be discarded.
data_format (str): The format of input and output data. It should be 'NHWC' or 'NCHW'.
Default: 'NCHW'.