AveragePool
Description
Performs average pooling on the input tensor.
Input
X: input tensor of type float16 or float, in NCHW format. The data format can be ND.
Attribute
auto_pad (optional): The options are NOTSET, SAME_UPPER, and VALID. The default value is NOTSET.
count_include_pad: int, not supported currently.
kernel_shape (optional):
- 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):
- strides[0]: int32, stride along the H dimension. The default value is 1.
- strides[1]: int32, stride along the W dimension. The default value is 1.
pads (optional):
- 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, either 0 (floor mode) or 1 (ceil mode). The default value is 0.
Output
Y: output tensor of type float16 or float, in NCHW format. The data format can be ND.
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.
- If N of the input tensor is a prime number, N must be less than 65535.
- The ceil_mode parameter takes effect only when auto_pad is set to NOTSET.
- The atc tool does not support the input of the float type when the --precision_mode=must_keep_origin_dtype parameter is used.
- The auto_pad attribute supports SAME_UPPER but does not support SAME_LOWER because both SAME_LOWER and SAME_UPPER use the SAME attribute of TBE. However, TBE operators do not differentiate the padding position based on this attribute, which may result in accuracy issues.
- If the window range exceeds the original width and height of the input feature map and count_include_pad is False, the divisor denominator in operator calculation may be 0, and the output may be 0, 65504, Nan, or INF. This scenario does not comply with the operator's normal service logic. You are advised to modify attributes such as ceil_mode or stride to ensure that the window always intersects with the input feature map.
ONNX Opset Support
Opset v8/v9/v10/v11/v12/v13/v14/v15/v16/v17/v18
Parent topic: Supported ONNX Operators