- This API performs 2D average pooling on the input tensor with the kernel size of and the stride of . is kernelSize, indicating the size of the pooling window. is stride, indicating the stride of the pooling operation.
- Formula: The relationship among input (), output out (), pooling step (), and pooling window size () is as follows:
Each operator has calls. First, aclnnAvgPool2dGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnAvgPool2d is called to perform computation.
Parameters:
[object Object]cubeMathType: The following enumerated values are supported:
- 0: KEEP_DTYPE. The input data type is retained for computation.
- [object Object]Atlas training products[object Object] and [object Object]Atlas inference products[object Object]: This option is not supported when the input data type is FLOAT32.
- 1: ALLOW_FP32_DOWN_PRECISION. The input data can be computed with reduced precision.
- [object Object]Atlas training products[object Object] and [object Object]Atlas inference products[object Object]: If the input data type is FLOAT32, it will be converted to FLOAT16 for computation. When the input is of other data types, it is not processed.
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: This option is not supported when the input data type is FLOAT32. When the input is of other data types, it is not processed.
- 2: USE_FP16. The input data can be downgraded to FLOAT16 for computation.
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: This option is not supported when the input data type is BFLOAT16.
- 3: USE_HF32. This option is not supported.
- 0: KEEP_DTYPE. The input data type is retained for computation.
Returns:
[object Object]: status code. For details, see .The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]
Deterministic compute:
- aclnnAvgPool2d defaults to a deterministic implementation.
[object Object]Atlas training products[object Object]: The Cube unit does not support FLOAT32 computation. The input data type FLOAT32 can be converted to FLOAT16 in the API for computation by setting cubeMathType to 1 (ALLOW_FP32_DOWN_PRECISION).
The following example is for reference only. For details, see .