Description:
- Provides two-dimensional (H, W) max pooling for the input channels of the input signal, and outputs the pooled value out and indices.
- In the input dims, N represents the batch size, C represents the channel, D represents the depth, W represents the width, and H represents the height.
Formula:
Calculation formula of each element of the output tensor:
Formula for deducing the output tensor shape: (The shape of indices tensor is the same as that of out tensor.)
Each operator has calls. First, aclnnMaxPool2dWithIndicesGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnMaxPool2dWithIndices is called to perform computation.
[object Object][object Object]
Parameters:
- self (aclTensor*, compute input): input tensor, aclTensor on the device. The data type can be BFLOAT16, FLOAT16, or FLOAT32. The shape supports three dimensions (C, H, W) or four dimensions (N, C, H, W). Other shapes are not supported. are supported.
- kernelSize (aclIntArray*, compute input): maximum pooling window size. The data type can be INT64. The array length must be 1 or 2, and all array elements must be greater than 0.
- stride (aclIntArray*, compute input): stride of the window. The data type can be INT64. The array length must be 0, 1, or 2, and all array elements must be greater than 0. When the array length is 0, the value of kernelSize is used as strides.
- padding (aclIntArray*, compute input): the number of layers of padding to be applied on each side, with negative infinity values used for padding. The data type can be INT64. The array length must be 1 or 2, and all array elements must be greater than or equal to 0 or less than or equal to kernelSize divided by 2.
- dilation (aclIntArray*, compute input): controls the stride between elements in the window. The data type can be INT64. The array length must be 1 or 2.
- ceilMode (bool, compute input): mode of computing the output shape, that is, rounding up (True) or rounding down (False).
- out (aclTensor *, compute output): output tensor, aclTensor on the device. It is the pooled result. The data type can be BFLOAT16, FLOAT16, or FLOAT32. The shape is deduced from the preceding formula. The must be the same as that of self.
- indices (aclTensor *, compute output): output tensor, aclTensor on the device. This tensor consists of the index positions of maximum values. The data type can be INT32 or INT64. The shape is the same as that of out. The must be the same as that of self.
- workspaceSize (uint64_t *, output): size of the workspace to be allocated on the device.
- executor (aclOpExecutor **, output): operator executor, containing the operator computation process.
Returns:
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 aclnnMaxPool2dWithIndicesGetWorkspaceSize.
- executor (aclOpExecutor *, input): operator executor, containing the operator computation process.
- stream (aclrtStream, input): stream for executing the task.
Returns:
Deterministic compute:
- aclnnMaxPool2dWithIndices defaults to a deterministic implementation.
[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 input data does not support NaN and -Inf.
- If ceilMode is set to True and sliding windows are all in the right padded region, the output result will be ignored.
The following example is for reference only. For details, see .