On this page
torch.nn.functional.avg_pool1d
torch.nn.functional.avg_pool1d(input, kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True) → Tensor
-
Applies a 1D average pooling over an input signal composed of several input planes.
See
AvgPool1d
for details and output shape.- Parameters
-
- input – input tensor of shape
- kernel_size – the size of the window. Can be a single number or a tuple
(kW,)
- stride – the stride of the window. Can be a single number or a tuple
(sW,)
. Default:kernel_size
- padding – implicit zero paddings on both sides of the input. Can be a single number or a tuple
(padW,)
. Default: 0 - ceil_mode – when True, will use
ceil
instead offloor
to compute the output shape. Default:False
- count_include_pad – when True, will include the zero-padding in the averaging calculation. Default:
True
Examples:
>>> # pool of square window of size=3, stride=2 >>> input = torch.tensor([[[1, 2, 3, 4, 5, 6, 7]]], dtype=torch.float32) >>> F.avg_pool1d(input, kernel_size=3, stride=2) tensor([[[ 2., 4., 6.]]])
© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/2.1/generated/torch.nn.functional.avg_pool1d.html