Skip to content

Commit d7a5ec9

Browse files
ILCSFNOpytorchmergebot
authored andcommitted
Fix the Doc of padding in avg_poolnd (#159142)
Fixes #159141 Pull Request resolved: #159142 Approved by: https://github.com/mikaylagawarecki
1 parent 2c46922 commit d7a5ec9

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

torch/nn/functional.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,6 @@
338338
Applies a 1D average pooling over an input signal composed of several
339339
input planes.
340340
341-
.. note::
342-
pad should be at most half of effective kernel size.
343-
344341
See :class:`~torch.nn.AvgPool1d` for details and output shape.
345342
346343
Args:
@@ -349,8 +346,9 @@
349346
tuple `(kW,)`
350347
stride: the stride of the window. Can be a single number or a tuple
351348
`(sW,)`. Default: :attr:`kernel_size`
352-
padding: implicit zero paddings on both sides of the input. Can be a
353-
single number or a tuple `(padW,)`. Default: 0
349+
padding: implicit zero paddings on both sides of the input. Can be a single
350+
number or a tuple `(padW,)`. Should be at most half of effective kernel
351+
size, that is :math:`((kernelSize - 1) * dilation + 1) / 2`. Default: 0
354352
ceil_mode: when True, will use `ceil` instead of `floor` to compute the
355353
output shape. Default: ``False``
356354
count_include_pad: when True, will include the zero-padding in the
@@ -376,9 +374,6 @@
376374
:math:`sH \times sW` steps. The number of output features is equal to the number of
377375
input planes.
378376
379-
.. note::
380-
pad should be at most half of effective kernel size.
381-
382377
See :class:`~torch.nn.AvgPool2d` for details and output shape.
383378
384379
Args:
@@ -388,7 +383,9 @@
388383
stride: stride of the pooling operation. Can be a single number, a single-element tuple or a
389384
tuple `(sH, sW)`. Default: :attr:`kernel_size`
390385
padding: implicit zero paddings on both sides of the input. Can be a
391-
single number, a single-element tuple or a tuple `(padH, padW)`. Default: 0
386+
single number, a single-element tuple or a tuple `(padH, padW)`.
387+
Should be at most half of effective kernel size, that
388+
is :math:`((kernelSize - 1) * dilation + 1) / 2`. Default: 0
392389
ceil_mode: when True, will use `ceil` instead of `floor` in the formula
393390
to compute the output shape. Default: ``False``
394391
count_include_pad: when True, will include the zero-padding in the
@@ -407,9 +404,6 @@
407404
size :math:`sT \times sH \times sW` steps. The number of output features is equal to
408405
:math:`\lfloor\frac{\text{input planes}}{sT}\rfloor`.
409406
410-
.. note::
411-
pad should be at most half of effective kernel size.
412-
413407
See :class:`~torch.nn.AvgPool3d` for details and output shape.
414408
415409
Args:
@@ -419,7 +413,9 @@
419413
stride: stride of the pooling operation. Can be a single number or a
420414
tuple `(sT, sH, sW)`. Default: :attr:`kernel_size`
421415
padding: implicit zero paddings on both sides of the input. Can be a
422-
single number or a tuple `(padT, padH, padW)`, Default: 0
416+
single number or a tuple `(padT, padH, padW)`. Should be at most half
417+
of effective kernel size, that is :math:`((kernelSize - 1) * dilation + 1) / 2`.
418+
Default: 0
423419
ceil_mode: when True, will use `ceil` instead of `floor` in the formula
424420
to compute the output shape
425421
count_include_pad: when True, will include the zero-padding in the

0 commit comments

Comments
 (0)