oneflow.nn.functional.avg_pool1d

oneflow.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.

The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.nn.functional.avg_pool1d.html

See AvgPool1d for details and output shape.

Parameters
  • input – input tensor of shape \((\text{minibatch} , \text{in_channels} , iW)\)

  • 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 of floor 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
>>> import oneflow
>>> input = oneflow.tensor([[[1, 2, 3, 4, 5, 6, 7]]], dtype=oneflow.float32)
>>> oneflow.nn.functional.avg_pool1d(input, kernel_size=3, stride=2)
tensor([[[2., 4., 6.]]], dtype=oneflow.float32)