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, optional) – 滑動視窗的步長padding (
list of int, optional) – 要新增到兩側的填充,必須 >= 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)