API description: Applies 2D bilinear upsampling to an input signal composed of several input channels.
- For input shape: If the input shape is (N, C, H, W), then the output shape is (N, C, outputSize[0], outputSize[1]).
- For center alignment selection: Pixels are generally regarded as a grid of points. When alignCorners is set to True, the pixel is regarded as the point in the upper left corner of the grid. The corner pixel of the output is center-aligned with the corner pixel of the original image, and the points in the same direction are equally spaced. When alignCorners is set to False, pixels are regarded as points on the cross lines of the grid. The corner pixel of the output is still the corner pixel of the original image, but the points in the same direction are not equally spaced.
Formula:
- Core algorithm logic:
- Scale the destination image to the same size as the source image.
- Calculate points of the scaled destination image and points of adjacent source images.
- Calculate the weights from the adjacent points to the target points, and multiply and accumulate the weights to obtain the target point values.
- Calculation logic:
An image can be scaled by corner alignment (that is, based on the center point of the pixels in the upper left corner of the source image) or edge alignment (that is, based on the vertex in the upper left corner and two edges of the source image). The two modes differ in the scaling factor and coordinates. Then:
Therefore, for a point p (x, y) in a direction of the output, a point mapped back to the source image is denoted as q (x', y'). Then:
Denoted:
Then:
- Core algorithm logic:
Each operator has calls. First, aclnnUpsampleBilinear2dGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnUpsampleBilinear2d is called to perform computation.
Parameters:
[object Object][object Object]Atlas inference products[object Object] and [object Object]Atlas training products[object Object]:
The data types of
[object Object]and[object Object]do not support BFLOAT16.
Returns:
aclnnStatus: status code. For details, see .
The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]
Parameters:
[object Object]Returns:
aclnnStatus: status code. For details, see .
- If alignCorners is set to True, either outputSize or scalesH/scalesW must be used.
- If the value of the corresponding axis of outputSize is less than or equal to 1, the value of the corresponding axis of scales is 0.
- In other cases, the values of the corresponding axes in self and outputSize are used, and .
- If alignCorners is set to False:
- If the value of scalesH or scalesW is equal to 0, the value of outputSize is used.
- If the value of the corresponding axis of outputSize is 0, the corresponding value of scales is 0.
- If the value of the corresponding axis of outputSize is not 0, .
- If the values of both scalesH and scalesW are greater than 0, the values of scalesH, scalesW, and outputSize are used.
- If the value of scalesH or scalesW is equal to 0, the value of outputSize is used.
- Deterministic computing:
- aclnnUpsampleBilinear2d defaults to a deterministic implementation.
The following example is for reference only. For details, see .