- Description: Converts the data type of the quantization parameter scale from FLOAT32 to UINT64 or INT64 required by the hardware.
- Formula:
[object Object]is in 64-bit format and is initialized to 0.The higher 19 bits of
[object Object]are truncated and stored in bit 32 of[object Object], and bit 46 is changed to 1.The subsequent computation is performed based on the value of
[object Object].- If
[object Object]does not exist, no subsequent computation is performed. - If
[object Object]exists:The value of
[object Object]is converted to an int value in the range of [–256, 255].Nine bits of
[object Object]are retained and stored in bits 37 to 45 of out.
- If
Each operator has calls. First, aclnnTransQuantParamV2GetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnTransQuantParamV2 is called to perform computation.
Parameters:
[object Object]Returns:
[object Object]: status code. For details, see .The first-phase API implements input parameter verification. The following errors may be thrown:
[object Object]
- [object Object]Atlas inference products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object], [object Object]Atlas A3 training products/Atlas A3 inference products[object Object], and Ascend 950 PR/Ascend 950 DT: This API can be used together with matmul operators (such as ).
- [object Object]Atlas inference 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]: This API cannot be used together with grouped matmul operators (such as aclnnGroupedMatmulV4).
- The shapes of scale, offset, and out are described as follows:
- If offset does not exist, the shape of out is the same as that of scale.
- If out is used as the input of a matmul operator (for example, ), the shape can be one-dimensional (1,) or (n,), or two-dimensional (1, n). Here, n is the same as the shape of the right matrix (corresponding to x2) in matmul computation.
- If out is used as the input of a grouped matmul operator (for example, aclnnGroupedMatmulV4), it is used only when the grouping mode is m-axis grouping (corresponding to groupType = 0). The shape can be one-dimensional (g,), or two-dimensional (g, 1), or (g, n). Here, n is the same as the shape of the right matrix (corresponding to x2) in grouped matmul computation, and g is the same as the number of groups (corresponding to the shape size of groupListOptional) in grouped matmul computation.
- If offset exists, it is used only as the input of a matmul operator (for example, ).
- The shapes of offset, scale, and out can be one-dimensional (1,) or (n,), or two-dimensional (1, n). Here, n is the same as the shape of the right matrix (corresponding to x2) in matmul computation.
- If the shape of the input scale is one-dimensional, the shape of out is also one-dimensional, and the shape size is the larger of the two one-dimensional shape sizes of scale and offset.
- If the shape of the input scale is two-dimensional, the shape of out is the same as that of the input scale in terms of dimension and size.
- If offset does not exist, the shape of out is the same as that of scale.
- Deterministic compute:
- aclnnTransQuantParamV2 defaults to a deterministic implementation.
The following example is for reference only. For details, see .