Note: This API will be deprecated in later versions. Use the latest aclnnQuantMatmulV5 API instead.
- API function: performs quantized matrix multiplication. The maximum number of input dimensions is 3. Similar APIs include (only two-dimensional tensors can be used as the input of matrix multiplication) and (only three-dimensional matrix multiplication is supported, whose first dimension is the batch dimension).
- Formula:
Each operator has calls. First, [object Object] is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, [object Object] is called to perform computation.
[object Object]
[object Object]
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]
- Deterministic description:
- [object Object]Atlas A3 training products/Atlas A3 inference products[object Object] and [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: The aclnnQuantMatmulV2 API is implemented in deterministic mode by default.
To migrate this API to the aclnnQuantMatmulV4 API, perform the following steps:
- The inputs x1, x2, bias, adjX1, and adjX2 can be directly converted to x1, x2, bias, transposeX1, and transposeX2 in the aclnnQuantMatmulV4 API.
- The input deqScale is a UINT64 aclTensor, and has the same data type as scale in aclnnQuantMatmulV4. The deqScale shape of aclnnQuantMatmulV2 is one-dimensional (t,), where t = align(n, 16). The scale shape of aclnnQuantMatmulV4 is one-dimensional (t,), where t = 1 or n. aclnnTransQuantParamV2 can be called for the original FLOAT quantization parameters to get an output aclTensor, whose output data type is UINT64 and shape is (n,). (For details, see ). The value is recorded as scale, which is the same as scale in the aclnnQuantMatmulV4 API.
- Set the optional inputs offset and pertokenScaleOptional in the aclnnQuantMatmulV4 API to nullptr.
- Set the API parameters to
[object Object].
The following example is for reference only. For details, see .
[object Object]