評價此頁

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