[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: For the input self with shape [N,C,H,W][N, C, H, W], where N (Batch) indicates the batch size, C (Channels) indicates the number of feature map channels, H (Height) indicates the feature map height, W (Width) indicates the feature map width, and outputSize is [Ho,Wo][H_o, W_o], the output shape is [N,C,Ho,Wo][N, C, H_o, W_o] and the indices shape is [N,C,Ho,Wo][N, C, H_o, W_o]. Here, mm indicates the index of the output height dimension (value range: [0,Ho)[0, H_o)), and nn indicates the index of the output width dimension (value range: [0,Wo)[0, W_o)). The calculation formula for each element (m,n)(m, n) in the corresponding tensor is as follows:Hleftm=(mH)/HoHrightm=(mH)/HoWleftn=(nW)/WoWrightn=(nW)/Wooutput(N,C,m,n)=maxj[Hleftm,Hrightm],k[Wleftn,Wrightn]input(N,C,j,k)indices(N,C,m,n)=argmaxj[Hleftm,Hrightm],k[Wleftn,Wrightn]input(N,C,j,k)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,m,n) = \mathop{\max}\limits_{j\in[H_{left}^m,H_{right}^m],k\in[W_{left}^n,W_{right}^n]} input(N,C,j,k) \\ indices(N,C,m,n) = \mathop{\arg\max}\limits_{j\in[H_{left}^m,H_{right}^m],k\in[W_{left}^n,W_{right}^n]} input(N,C,j,k)
[object Object]

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

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

    [object Object]
  • Returns:

    [object Object]: status code. For details, see .

    The first-phase API implements input parameter verification. The following errors may be thrown.

    [object Object]
[object Object]
  • Parameters:

    [object Object]
  • Returns:

    [object Object]: status code. For details, see .

[object Object]
  • Deterministic compute:

    • aclnnAdaptiveMaxPool2dBackward defaults to a non-deterministic implementation. You can call aclrtCtxSetSysParamOpt to enable deterministic compute.
  • In the case of non-integer division (the remainder of the dimension values of the last two dimensions of self divided by the dimension values of the last two dimensions of gradOutput is not 0), the shape cannot exceed 2 to the power of 24. If the shape is exactly divisible, there is no such restriction.

  • Example of integer division: self = [a, b, c, d], gradOutput = [a, b, e, f]. If c%e is 0 and d%f is 0, it is an integer division scenario.

[object Object]

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

[object Object]