- Description: Performs max pooling on the three-dimensional or four-dimensional input tensor.
- Formula:
When ceilMode is set to False, the H and W dimensions in the shape of the out tensor are deduced as follows:
When ceilMode is set to True, the H and W dimensions in the shape of the out tensor are deduced as follows:
- If the upper left corner of the sliding window starts from the lower or right padding or goes off-bounds (no valid value can be obtained), the sliding window result is discarded. The shape of the corresponding spatial axis needs to be subtracted by 1 based on the preceding deduction formula.
Each operator has calls. First, aclnnMaxPoolGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnMaxPool is called to perform computation.
[object Object][object Object]
Parameters:
- self (aclTensor*, compute input): aclTensor on the device, corresponding to H_in and W_in in the formula. The shape must be three-dimensional (C, H, W) or four-dimensional (N, C, H, W). N indicates the batch size, C indicates the tensor channel size, H indicates the tensor height, and W indicates the tensor width. Other dimensions are not supported. are supported. The can be ND.
- [object Object]Atlas training series products[object Object]: The data type can be FLOAT16.
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be FLOAT16 or FLOAT32.
- kernelShape (aclIntArray*, compute input): size of the max pooling window, corresponding to k_h and k_w in the formula. The length is 1 or 2, and the array elements must be greater than 0.
- strides (aclIntArray*, compute input): strides of the window, corresponding to s_h and s_w in the formula. The array length is 0, 1, or 2, and the array elements must be greater than 0. If the array length is 0, the default value 1 is used for strides.
- autoPad (int64_t, compute input): padding mode. The value can only be set to 0, which indicates NOTSET.
- pads (aclIntArray*, compute input): padding at the start and end positions along the spatial axis, corresponding to padding_size in the formula. The length can be 0, 1, 2, or 4. If the array length is 0, no padding is performed. If the array length is 1, the same value is padded to H_top, H_bottom, W_left, and W_right. If the array length is 2, H_top and H_bottom are padded with the first value in the array, and W_left and W_right are padded with the second value in the array. If the array length is 4, padding is performed based on the [H_top, W_left, H_bottom, W_right] position. The sum of paddings in single spatial axis directions must be less than or equal to the kernelShape in the corresponding direction.
- dilations (aclIntArray*, compute input): dilation value along the kernel spatial axis, corresponding to dilation_size in the formula. Only the input scenario where the value is 1 is supported. The length can be 0, 1, 2, or 4.
- ceilMode (int64_t, compute input): rounding mode of the output shape. The value 0 indicates False (round down), and a non-zero value indicates True (round up).
- out (aclTensor*, compute output): The data type is the same as that of self. The shape is deduced from the preceding formula. The data format and dimensions are the same as those of the input self.
- [object Object]Atlas training series products[object Object]: The data type can be FLOAT16.
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be FLOAT16 or FLOAT32.
- workspaceSize (uint64_t*, output): size of the workspace to be allocated on the device.
- executor (aclOpExecutor**, output): operator executor, containing the operator computation process.
- self (aclTensor*, compute input): aclTensor on the device, corresponding to H_in and W_in in the formula. The shape must be three-dimensional (C, H, W) or four-dimensional (N, C, H, W). N indicates the batch size, C indicates the tensor channel size, H indicates the tensor height, and W indicates the tensor width. Other dimensions are not supported. are supported. The can be ND.
Returns:
[object Object]
Parameters:
- workspace (void*, input): address of the workspace to be allocated on the device.
- workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by the first-phase API aclnnMaxPoolGetWorkspaceSize.
- executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
- stream (aclrtStream, input): stream for executing the task.
Returns:
- Deterministic compute:
- aclnnMaxPool defaults to a deterministic implementation.
The following example is for reference only. For details, see .
[object Object]