提交 d8ea0168 编写于 作者: M Megvii Engine Team

docs(mge): update AvgPool2d & functional.nn.max_pool2d docstring

GitOrigin-RevId: d69c5b024f6b298b829dcfecdaf872d822b1dd00
上级 01353b2d
......@@ -697,20 +697,19 @@ def avg_pool2d(
Refer to :class:`~.AvgPool2d` for more information.
Args:
inp: input tensor of shape :math:`(N, C, H_{in}, W_{in})`.
inp: input tensor of shape :math:`(N, C, H_{\text{in}}, W_{\text{in}})` .
kernel_size: size of the window used to calculate the average value.
stride: stride of the window. If not provided, its value is set to ``kernel_size``.
Default: ``None``
padding: implicit zero padding added on both sides. Default: :math:`0`
stride: stride of the window. Default value is ``kernel_size``.
padding: implicit zero padding added on both sides. Default: 0.
mode: whether to include the padding values while calculating the average, set
to "average" will do counting.
Default: "average_count_exclude_padding"
Returns:
output tensor of shape `(N, C, H_{out}, W_{out})`.
output tensor of shape :math:`(N, C, H_{\text{out}}, W_{\text{out}})`.
Examples:
>>> input = tensor(np.arange(1 * 1 * 3 * 4).astype(np.float32).reshape(1, 1, 3, 4))
>>> input = Tensor(np.arange(1 * 1 * 3 * 4).astype(np.float32).reshape(1, 1, 3, 4))
>>> F.avg_pool2d(input, kernel_size=2, stride=2, padding=[1,0], mode="average")
Tensor([[[[0.25 1.25]
[6.5 8.5 ]]]], device=xpux:0)
......
......@@ -69,9 +69,9 @@ class MaxPool2d(_PoolNd):
class AvgPool2d(_PoolNd):
r"""Applies a 2D average pooling over an input.
For instance, given an input of the size :math:`(N, C, H, W)` and
For instance, given an input of the size :math:`(N, C, H_{\text{in}}, W_{\text{in}})` and
:attr:`kernel_size` :math:`(kH, kW)`, this layer generates the output of
the size :math:`(N, C, H_{out}, W_{out})` through a process described as:
the size :math:`(N, C, H_{\text{out}}, W_{\text{out}})` through a process described as:
.. math::
......@@ -83,10 +83,10 @@ class AvgPool2d(_PoolNd):
Args:
kernel_size: the size of the window.
stride: the stride of the window. Default value is kernel_size。
padding: implicit zero padding to be added on both sides.
mode: whether to count padding values. "average" mode will do counting and
"average_count_exclude_padding" mode won't do counting.
stride: the stride of the window. Default value is ``kernel_size``.
padding: implicit zero padding to be added on both sides.Default: 0.
mode: whether to include the padding values while calculating the average, set
to "average" will do counting.
Default: "average_count_exclude_padding"
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册