torch.quantized_max_pool2d¶
- torch.quantized_max_pool2d(input, kernel_size, stride=[], padding=0, dilation=1, ceil_mode=False) Tensor ¶
將 2D 最大池化應用於由多個輸入平面組成的輸入量化張量。
- 參數
input (Tensor) – 量化張量
kernel_size (
list of int
) – 滑動窗口的大小stride (
list of int
, optional) – 滑動窗口的步幅(stride)padding (
list of int
, optional) – 要在兩側添加的填充(padding),必須 >= 0 且 <= kernel_size / 2dilation (
list of int
, optional) – 滑動窗口內元素之間的步幅,必須 > 0。預設值為 1ceil_mode (bool, optional) – 如果為 True,將使用 ceil 而不是 floor 來計算輸出形狀。預設值為 False。
- 返回值
應用 max_pool2d 的量化張量。
- 返回類型
範例
>>> 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)