Add pad limit of avg_poolnd and AvgPoolnd (#152680)

Fixes #152156

Pull Request resolved: https://github.com/pytorch/pytorch/pull/152680
Approved by: https://github.com/mikaylagawarecki
This commit is contained in:
ILCSFNO
2025-05-04 17:25:19 +00:00
committed by PyTorch MergeBot
parent 370e23388d
commit a69da90a9f
2 changed files with 18 additions and 0 deletions

View File

@ -350,6 +350,9 @@ avg_pool1d(input, kernel_size, stride=None, padding=0, ceil_mode=False, count_in
Applies a 1D average pooling over an input signal composed of several
input planes.
.. note::
pad should be at most half of effective kernel size.
See :class:`~torch.nn.AvgPool1d` for details and output shape.
Args:
@ -385,6 +388,9 @@ Applies 2D average-pooling operation in :math:`kH \times kW` regions by step siz
:math:`sH \times sW` steps. The number of output features is equal to the number of
input planes.
.. note::
pad should be at most half of effective kernel size.
See :class:`~torch.nn.AvgPool2d` for details and output shape.
Args:
@ -413,6 +419,9 @@ Applies 3D average-pooling operation in :math:`kT \times kH \times kW` regions b
size :math:`sT \times sH \times sW` steps. The number of output features is equal to
:math:`\lfloor\frac{\text{input planes}}{sT}\rfloor`.
.. note::
pad should be at most half of effective kernel size.
See :class:`~torch.nn.AvgPool3d` for details and output shape.
Args:

View File

@ -607,6 +607,9 @@ class AvgPool1d(_AvgPoolNd):
When ceil_mode=True, sliding windows are allowed to go off-bounds if they start within the left padding
or the input. Sliding windows that would start in the right padded region are ignored.
.. note::
pad should be at most half of effective kernel size.
The parameters :attr:`kernel_size`, :attr:`stride`, :attr:`padding` can each be
an ``int`` or a one-element tuple.
@ -688,6 +691,9 @@ class AvgPool2d(_AvgPoolNd):
When ceil_mode=True, sliding windows are allowed to go off-bounds if they start within the left padding
or the input. Sliding windows that would start in the right padded region are ignored.
.. note::
pad should be at most half of effective kernel size.
The parameters :attr:`kernel_size`, :attr:`stride`, :attr:`padding` can either be:
- a single ``int`` -- in which case the same value is used for the height and width dimension
@ -797,6 +803,9 @@ class AvgPool3d(_AvgPoolNd):
When ceil_mode=True, sliding windows are allowed to go off-bounds if they start within the left padding
or the input. Sliding windows that would start in the right padded region are ignored.
.. note::
pad should be at most half of effective kernel size.
The parameters :attr:`kernel_size`, :attr:`stride` can either be:
- a single ``int`` -- in which case the same value is used for the depth, height and width dimension