MaxPool

Description

Performs max pooling on the input tensor x based on the kernel size, stride size, and padding length. Max pooling includes calculating a maximum value of all values of a subset of the input tensor based on a kernel size, and downsampling data to an output tensor y for further processing. The spatial shape of the output is calculated based on whether explicit padding is used, whether pads or auto_pad (which cannot be used together) is used.

Input

x: input tensor of type float or float16. The format is NCHW.

Attributes

auto_pad (optional): supports SAME_UPPER, SAME_LOWER, VALID and NOTSET.

kernel_shape (mandatory): The options are as follows:

  • kernel_shape[0]: int32, indicating the window size along the H dimension. The value range is [1, 32768], and the default value is 1.
  • kernel_shape[1]: int32, indicating the window size along the W dimension. The value range is [1, 32768], and the default value is 1.

strides (optional): The options are as follows:

  • strides[0]: int32, indicating the stride along the H dimension. The value ranges from , and defaults to 1.
  • strides[1]: int32, indicating the stride along the W dimension. The value ranges from, and defaults to 1.

pads (optional): The options are as follows:

  • pads[0]: int32, top padding. Defaults to 0.
  • pads[1]: int32, bottom padding. Defaults to 0.
  • pads[2]: int32, left padding. Defaults to 0.
  • pads[3]: int32, right padding. Defaults to 0.

ceil_mode (optional): int32. The value can be 0 (floor mode) or 1 (ceil mode). Defaults to 0.

Output

y: output tensor of the identical data type to the input. The format is NCHW.

Constraints

  • When the strides[0] or strides[1] is greater than 63, the AI CPU is used for computing, which deteriorates the performance.
  • If the value of kernel_shape[0] or kernel_shape[1] exceeds the value of [1,255] or kernel_shape[0] * kernel_shape[1] > 256, the AI CPU is used for computing, which deteriorates the performance.
  • 1 <= input_w <= 4096.
  • When N of the input tensor is a prime number, N must be less than 65535.
  • 2D tensor inputs do not support dilations.
  • When auto_pad is VALID, ceil_mode must be 0.
  • pads and auto_pad cannot be used at the same time.

ONNX Opset Support

Opset v8/v9/v10/v11/v12/v13/v14/v15/v16/v17/v18