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 are used, or whether auto_pad (automatic padding) is used.
Input
x: input tensor of type float or float16. The format is NCHW.
Attribute
auto_pad (optional): supports SAME_UPPER, SAME_LOWER, VALID and NOTSET.
storage_order: This parameter is not supported currently.
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 range is , and the default value is 1.
- strides[1]: int32, indicating the stride along the W dimension. The value range is , and the default value is 1.
pads (optional): The options are as follows:
- pads[0]: int32, top padding. The default value is 0.
- pads[1]: int32, bottom padding. The default value is 0.
- pads[2]: int32, left padding. The default value is 0.
- pads[3]: int32, right padding. The default value is 0.
ceil_mode (optional): int32. The value can be 0 (floor mode) or 1 (ceil mode). The default value is 0.
Output
y: output tensor of the identical data type as the input. The format is NCHW.
Constraints
- When strides[0] or strides[1] is greater than 63, computation is performed on AI CPU, which will compromise 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.
- The 2D tensor input does not support dilations.
- When auto_pad is VALID, ceil_mode must be 0.
- The pads and auto_pad attributes cannot be used at the same time.
ONNX Opset Support
Opset v8/v9/v10/v11/v12/v13/v14/v15/v16/v17/v18