- API description: Performs backpropagation of .
- Formulas:
- Core forward algorithm logic:
- Map each point of the target image back to the original image to obtain a coordinate with a decimal point.
- Based on the floating-point coordinate, calculate the adjacent points of the original image.
- 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:
Assume that the output image out for forward interpolation is affected by the original image input . Then:
- Core forward algorithm logic:
Each operator has calls. First, aclnnUpsampleBilinear2dBackwardGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnUpsampleBilinear2dBackward is called to perform computation.
Parameters
[object Object]- [object Object]Atlas inference products[object Object], [object Object]Atlas training products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]:
- The data types of gradOut and out do not support BFLOAT16.
- The data type of the out parameter is the same as that of the gradOut parameter.
- Ascend 950PR/Ascend 950DT:
- If the data type of gradOut is not FLOAT, the data type of out is the same as that of gradOut.
- If the data type of gradOut is FLOAT, the data type of out can be FLOAT32, FLOAT16, or BFLOAT16.
- [object Object]Atlas inference products[object Object], [object Object]Atlas training products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], and [object Object]Atlas A3 training products/Atlas A3 inference products[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]
The inputSize, outputSize, scalesH, and scalesW parameters must meet the following restrictions:
Deterministic computation:
- aclnnUpsampleBilinear2dBackward defaults to a deterministic implementation.
The following example is for reference only. For details, see .