API description: Applies 2D bilinear upsampling to an input signal composed of several input channels.
- For the input shape, if the input shape is (N, C, H, W), 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, pixels are considered as points in the upper left corner of the grid. The pixels at the output corners are aligned with the center of the pixels at the corners of the original image, and the points in the same direction are equally spaced. When alignCorners is set to False, pixels are considered as points on the intersection lines of the grid. The pixels at the output corners are still the pixels at the corners of the original image, but the points in the same direction are not equally spaced.
Formulas:
- Core algorithm logic:
- Each point of the target image is mapped back to the original image to obtain a coordinate with a decimal point.
- Based on the floating-point coordinate, the adjacent points of the original image are calculated.
- 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. For a two-dimensional interpolation point (N, C, H, W), the following formula is used:
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 self and out do not support BFLOAT16.
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]
Parameters
[object Object]Returns:
[object Object]: status code. For details, see .
The parameters self, outputSize, scalesH, and scalesW must meet the following restrictions:
Deterministic computation:
- aclnnUpsampleBilinear2d defaults to a deterministic implementation.
The following example is for reference only. For details, see .