[object Object]

[object Object][object Object]undefined
[object Object]
  • API description: Applies the bicubic interpolation with anti-aliasing to upsample the input signal composed of several input channels. If the shape of the input tensor x is (N, C, H, W), then the shape of the output tensor out is (N, C, outputSize[0], outputSize[1]).

  • Formula: For a two-dimensional interpolation point (N,C,h,w)(N, C, h, w), the interpolation out(N,C,h,w)out(N, C, h, w) may be represented as:

    out(N,C,h,w)=i=0kWj=0kHW(i,j)f(hi,wj){out(N, C, h, w)}=\sum_{i=0}^{kW}\sum_{j=0}^{kH}{W(i, j)}*{f(h_i, w_j)} scaleH={(x.dim(2)1)/(outputSize[0]1)alignCorners=true1/scalesHalignCorners=false&scalesH>0x.dim(2)/outputSize[0]otherwisescaleH =\begin{cases} (x.dim(2)-1) / (outputSize[0]-1) & alignCorners=true \\ 1 / scalesH & alignCorners=false\&scalesH>0\\ x.dim(2) / outputSize[0] & otherwise \end{cases} scaleW={(x.dim(3)1)/(outputSize[1]1)alignCorners=true1/scalesWalignCorners=false&scalesW>0x.dim(3)/outputSize[1]otherwisescaleW =\begin{cases} (x.dim(3)-1) / (outputSize[1]-1) & alignCorners=true \\ 1 / scalesW & alignCorners=false\&scalesW>0\\ x.dim(3) / outputSize[1] & otherwise \end{cases}

    The values are as follows:

    • i and j are index variables of W(i,j)W(i, j).
    • If scaleH1scaleH ≥ 1, then kH=1/scaleHkH = 1/scaleH; otherwise, kH=4kH = 4.
    • If scaleW1scaleW ≥ 1, then kW=1/scaleWkW = 1/scaleW; otherwise, kW=4kW = 4.
    • hi=h+ih_i = |h| + i
    • wj=w+jw_j = |w| + j
    • f(hi,wj)f(h_i, w_j) is the pixel value of the original image in (hi,wj)(h_i, w_j).
    • W(i,j)W(i, j) is the weight of the bicubic anti-aliasing interpolation, which is defined as follows:W(d)={(a+2)d3(a+3)d2+1d1ad35ad2+8ad4a1<d<20otherwiseW(d) =\begin{cases} (a+2)|d|^3-(a+3)|d|^2+1 & |d|\leq1 \\ a|d|^3-5a|d|^2+8a|d|-4a & 1<|d|<2 \\ 0 & otherwise \end{cases} The values are as follows:
      • Anti-aliasing scenario: a=0.5a = –0.5.
      • d=(h,w)(hi,wj)d = |(h, w) - (h_i, w_j)|
[object Object]

Each operator has calls. First, aclnnUpsampleBicubic2dAAGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnUpsampleBicubic2dAA 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 validation. The following error codes may be returned.

    [object Object]
[object Object]
  • Parameters

    [object Object]
  • Returns:

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

[object Object]
  • The shape constraints of x and out are as follows:

    • The value of each dimension is less than or equal to 2^20.

    • The N and C axes of the output parameter must be the same as those of the x parameter, and the C, H, and W axes must be greater than 0.

    • The memory usage must be less than 60 GB. The memory size can be calculated according to the following formula:

      (x_Hx_W+out_Hout_W+x_Hout_W)NCsizeof(float)<60102410241024(x\_H * x\_W + out\_H * out\_W + x\_H * out\_W) * N * C * sizeof(float) < 60 * 1024 * 1024 * 1024

      The values are as follows:

      • N indicates the N axis of the input and output.
      • C indicates the C axis of the input and output.
    • N * C * x_H < 2^31

    • [object Object]Atlas A3 training products/Atlas A3 inference products[object Object] and [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]:

    The downscale factor in the input data scaling scenario must be less than or equal to 50. That is:

    Heightoftheinputshape/outputSizeH<=50Height of the input shape/outputSize_H <= 50 Widthoftheinputshape/outputSizeW<=50Width of the input shape/outputSize_W <= 50
  • The x, outputSize, scalesH, and scalesW parameters must meet the following requirements:

    outputSize_H=floor(x_HscalesH)outputSize\_H = floor(x\_H * scalesH) outputSize_W=floor(x_WscalesW)outputSize\_W = floor(x\_W * scalesW)
  • Deterministic computation:

    • aclnnUpsampleBicubic2dAA defaults to a deterministic implementation.
[object Object]

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

[object Object]