Description: Traverses different sampling points of feature maps of different sizes by using parameters such as the sample location, attention weights, mapped value feature, start index location of a multi-scale feature, and spatial size of a multi-scale feature map (which facilitates changing a sampling location from a normalized value to an absolute location).
Formula:
Map the normalized coordinates of the sampling point to the pixel coordinate system of the feature map at layer :
Determine the four integer grid points between which the sampling point falls:
$$ x_0 = \lfloor x \rfloor,\quad x_1 = x_0 + 1,\qquad y_0 = \lfloor y \rfloor,\quad y_1 = y_0 + 1 $$ Compute the offset of the sampling point relative to the upper-left grid point, which is used for interpolation weighting: $$\alpha_x = x - x_0, \qquad \alpha_y = y - y_0 $$
Compute the bilinear interpolation weight. The sum of the four adjacent points is 1.
Compute the feature vectors (length: ) corresponding to the sampling points.
$$ \operatorname{bilinear}(V;\,b,h,\ell,x,y) = w_{00} \, V_{b,\ell,y_0,x_0,h,:} + w_{10} \, V_{b,\ell,y_0,x_1,h,:} + w_{01} \, V_{b,\ell,y_1,x_0,h,:} + w_{11} \, V_{b,\ell,y_1,x_1,h,:} $$ Compute the weighted sum of the bilinear sampling results for all layers and all sampling points to obtain the final output: $$O_{b,q,h,:} = \sum_{\ell=0}^{L-1} \sum_{p=0}^{N_p-1} A_{b,q,h,\ell,p} \cdot \operatorname{bilinear}!\left(V;,b,h,\ell, x_{b,q,h,\ell,p}, y_{b,q,h,\ell,p}\right) $$
Each operator has calls. First, aclnnMultiScaleDeformableAttnFunctionGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnMultiScaleDeformableAttnFunction is called to perform computation.
Parameters:
[object Object]- Atlas inference series products: BFLOAT16 is not supported.
Returns:
aclnnStatus: status code. For details, see .
The first-phase API implements input parameter verification. The following errors may be thrown:
[object Object]
Deterministic compute:
- aclnnMultiScaleDeformableAttnFunction defaults to a deterministic implementation.
[object Object]Atlas inference series products[object Object]:
- channels%32 = 0, and channels ≤ 256
- 32 ≤ num_queries < 500000
- num_levels ≤ 16
- num_heads = [2, 4, 8]
- num_points = [4, 8]
[object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]:
- channels%8 = 0, and channels ≤ 256
- 32 ≤ num_queries < 500000
- num_levels ≤ 16
- num_heads ≤ 16
- num_points ≤ 16
The following example is for reference only. For details, see .