评价此页

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#

kH×kWkH \times kW 区域上应用 2D 平均池化操作,步长为 sH×sWsH \times sW。输出特征的数量等于输入平面的数量。

有关详细信息和输出形状,请参阅 AvgPool2d

参数
  • input – 输入张量 (minibatch,in_channels,iH,iW)(\text{minibatch} , \text{in\_channels} , iH , iW)

  • kernel_size – 池化区域的大小。可以是单个数字、单元素元组或元组 (kH, kW)

  • stride – 池化操作的步长。可以是单个数字、单元素元组或元组 (sH, sW)。默认为 kernel_size

  • padding – 输入两侧的隐式零填充。可以是单个数字、单元素元组或元组 (padH, padW)。应不超过有效核大小的一半,即 ((kernelSize1)dilation+1)/2((kernelSize - 1) * dilation + 1) / 2。默认为 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