评价此页

torch.nn.functional.avg_pool2d#

torch.nn.functional.avg_pool2d(input, kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True, divisor_override=None) Tensor#

Applies 2D average-pooling operation in kH×kWkH \times kW regions by step size sH×sWsH \times sW steps. The number of output features is equal to the number of input planes.

注意

padding 最多应该是有效核大小的一半。

See AvgPool2d for details and output shape.

参数
  • input – input tensor (minibatch,in_channels,iH,iW)(\text{minibatch} , \text{in\_channels} , iH , iW)

  • kernel_size – size of the pooling region. Can be a single number, a single-element tuple or a tuple (kH, kW)

  • stride – stride of the pooling operation. Can be a single number, a single-element tuple or a tuple (sH, sW). Default: kernel_size

  • padding – implicit zero paddings on both sides of the input. Can be a single number, a single-element tuple or a tuple (padH, padW). Default: 0

  • ceil_mode – when True, will use ceil instead of floor in the formula to compute the output shape. Default: False

  • count_include_pad – when True, will include the zero-padding in the averaging calculation. Default: True

  • divisor_override – 如果指定,将用作除数,否则将使用池化区域的大小。默认为 None