!39883 fix avgpool docs
Merge pull request !39883 from 范吉斌/code_docs_avg_pool
This commit is contained in:
commit
ab7e20c870
|
@ -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'。
|
||||
|
|
|
@ -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'。
|
||||
|
|
|
@ -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'.
|
||||
|
||||
|
|
|
@ -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'.
|
||||
|
||||
|
|
Loading…
Reference in New Issue