Description: Performs backpropagation of 3D average pooling, that is, to compute the input gradient of forward propagation of 3D average pooling.
Formula: The relationship among the input(), gradOutput(), pooling stride (), and kernelSize () during backpropagation is as follows:
If ceil_mode is true and the following condition is met:
Then, the shape of D_{out} needs to be reduced by 1. The same rule applies to H_{out},W_{out}.
Each operator has calls. First, aclnnAvgPool3dBackwardGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnAvgPool3dBackward is called to perform computation.
[object Object][object Object]
Parameters:
- gradOutput (aclTensor*, compute input): input gradient, which is an aclTensor on the NPU device. The gradient can be 4D () or 5D (). N indicates the batch size, C indicates the number of channels, and D, H, and W indicate the depth, height, and width, respectively. are supported. The can be ND. The data type can be BFLOAT16, FLOAT16, or FLOAT32, and must be the same as that of self.
- self (aclTensor*, compute input): input data during the forward process ( in the formula), which is an aclTensor on the NPU device. The shape can be 4D () or 5D (). are supported. The can be ND. The data type can be BFLOAT16, FLOAT16, or FLOAT32, and must be the same as that of gradOutput.
- kernelSize (aclIntArray*, compute input): aclIntArray on the host, indicating the pooling window size. The value is an INT64 array, with a length of 1 (KD = KH = KW) or 3 (KD, KH, KW). The value must be greater than 0.
- stride (aclIntArray*, compute input): aclIntArray on the host, indicating the stride of the pooling operation. The value is an INT64 array, with a length of 0 (the value is the same as that of kernelSize), 1 (SD = SH = SW), or 3 (SD, SH, SW). The value must be greater than 0.
- padding (aclIntArray*, compute input): aclIntArray on the host, indicating the number of zero-padding layers in the D, H, and W directions of the input. The value is an INT64 array, with a length of 1 (PD = PH = PW) or 3 (PD, PH, PW). The value is within the range of [0, kernelSize/2].
- ceilMode (bool, compute input): whether to round up the shape of the output deduced during forward average pooling. (The value True indicates to round up.) The data type can be BOOL.
- countIncludePad (bool, compute input): whether to include padded zeros when computing forward average pooling. (The value True indicates to include padded zeros.) The data type can be BOOL.
- divisorOverride (int64_t, compute input): divisor for computing average pooling. If specified, it is used as the divisor in the average pooling. When the value is 0, this attribute does not take effect. The data type can be INT64.
- output (aclTensor *, compute output): aclTensor on the device. The shape is the same as that of self. are supported. The can be ND. The data type and must be the same as those of gradOutput. The data type can be BFLOAT16, 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.
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 calling the first-phase API aclnnAvgPool3dBackwardGetWorkspaceSize.
- executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
- stream (aclrtStream, input): stream for executing the task.
Returns:
- Deterministic compute:
- aclnnAvgPool3dBackward defaults to a non-deterministic implementation. You can call aclrtCtxSetSysParamOpt to enable deterministic compute.
The following example is for reference only. For details, see .