[object Object]

[object Object][object Object]undefined
[object Object]
  • Description: Performs backpropagation of forward adaptive max pooling. The gradient is backfilled to the coordinate of the maximum value in each adaptive window. The coordinates are accumulated.

  • Forward propagation formula:

    [object Object]

    For the input self dimension [N,C,D,H,W][N,C,D,H,W] and outputSize value [Do,Ho,Wo][D_o,H_o,W_o], the output dimension is [N,C,Do,Ho,Wo][N,C,D_o,H_o,W_o] and the index dimension is [N,C,Do,Ho,Wo][N,C,D_o,H_o,W_o]. The calculation formula of each element in the corresponding tensor is as follows:

    Dleftl=(lD)/DoDrightl=(lD)/DoHleftm=(mH)/HoHrightm=(mH)/HoWleftn=(nW)/WoWrightn=(nW)/Wooutput(N,C,l,m,n)=maxi[Dleftl,Drightl],j[Hleftm,Hrightm],k[Wleftn,Wrightn]input(N,C,i,j,k)indices(N,C,l,m,n)=argmaxi[Dleftl,Drightl],j[Hleftm,Hrightm],k[Wleftn,Wrightn]input(N,C,i,j,k)D_{left}^l = \lfloor(l*D)/D_o\rfloor \\ D_{right}^l = \lceil(l*D)/D_o\rceil \\ H_{left}^m = \lfloor(m*H)/H_o\rfloor \\ H_{right}^m = \lceil(m*H)/H_o\rceil \\ W_{left}^n = \lfloor(n*W)/W_o\rfloor \\ W_{right}^n = \lceil(n*W)/W_o\rceil \\ output(N,C,l,m,n) = \mathop{\max}\limits_{i \in [D_{left}^l,D_{right}^l],j\in[H_{left}^m,H_{right}^m],k\in[W_{left}^n,W_{right}^n]} input(N,C,i,j,k) \\ indices(N,C,l,m,n) = \mathop{\arg\max}\limits_{i \in [D_{left}^l,D_{right}^l],j\in[H_{left}^m,H_{right}^m],k\in[W_{left}^n,W_{right}^n]} input(N,C,i,j,k)
[object Object]

Each operator has calls. First, aclnnAdaptiveMaxPool3dBackwardGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnAdaptiveMaxPool3dBackward is called to perform computation.

  • [object Object]
  • [object Object]
[object Object]
  • Parameters:

    • gradOutput (aclTensor *, compute input): gradient tensor, which is an aclTensor on the device. The data type can be FLOAT32, FLOAT16, or BFLOAT16. The shape is the same as that of the forward output. are supported. The can be ND. When the input is 5D, it is processed as NCDHW. When the input is 4D, it is padded with 1s in dimension 0 and processed as NCDHW.

    • self (aclTensor *, compute input): forward input tensor, which is an aclTensor on the device. The data type can be FLOAT32, FLOAT16, or BFLOAT16. are supported. The can be ND. When the input is 5D, it is processed as NCDHW. When the input is 4D, it is padded with 1s in dimension 0 and processed as NCDHW, same as that of gradOutput.

    • indices (aclTensor *, compute input): input tensor, which is an aclTensor on the device. The data type can only be INT32. It indicates the index of the maximum element in the forward input. The must be the same as that of gradOutput. The shape is the same as that of gradOutput.

    • gradInput (aclTensor *, compute output): backward output tensor, which is an aclTensor on the device. The data type can be FLOAT32, FLOAT16, or BFLOAT16. The shape must be the same as that of self. are supported. 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:

    aclnnStatus: status code. For details, see .

[object Object]
[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 calling the first-phase API aclnnAdaptiveMaxPool3dBackwardGetWorkspaceSize.
    • executor (aclOpExecutor *, input): operator executor, containing the operator computation process.
    • stream (aclrtStream, input): stream for executing the task.
  • Returns:

    aclnnStatus: status code. For details, see .

[object Object]
  • Deterministic compute:

    • aclnnAdaptiveMaxPool3dBackward defaults to a non-deterministic implementation. You can call aclrtCtxSetSysParamOpt to enable deterministic compute.
  • If the shape is not exactly divisible, the value of shape cannot exceed 2 to the power of 24. If the shape is exactly divisible, there is no such restriction.

[object Object]

The following example is for reference only. For details, see .

[object Object]