快捷方式

torch.quantized_max_pool2d

torch.quantized_max_pool2d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False) Tensor

在由多個輸入平面組成的輸入量化張量上應用二維最大池化。

引數
  • input (Tensor) – 量化張量

  • kernel_size (list of int) – 滑動視窗的大小

  • stride (list of int, 可選) – 滑動視窗的步長

  • padding (list of int, 可選) – 在兩側新增的填充,必須 >= 0 且 <= kernel_size / 2

  • dilation (list of int, 可選) – 滑動視窗內元素之間的步長,必須 > 0。預設為 1

  • ceil_mode (bool, 可選) – 如果為 True,將使用 ceil(向上取整)而不是 floor(向下取整)來計算輸出形狀。預設為 False。

返回

應用 max_pool2d 後的量化張量。

返回型別

Tensor

示例

>>> qx = torch.quantize_per_tensor(torch.rand(2, 2, 2, 2), 1.5, 3, torch.quint8)
>>> torch.quantized_max_pool2d(qx, [2,2])
tensor([[[[1.5000]],

        [[1.5000]]],


        [[[0.0000]],

        [[0.0000]]]], size=(2, 2, 1, 1), dtype=torch.quint8,
    quantization_scheme=torch.per_tensor_affine, scale=1.5, zero_point=3)

文件

查閱 PyTorch 的完整開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得解答

檢視資源