Note: This API will be deprecated in later versions. Use the latest aclnnQuantMatmulV5 API instead.
API function: performs quantized matrix multiplication. The minimum supported dimension is 2 and the maximum supported input dimension 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.
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 aclnnQuantMatmul is implemented in deterministic mode by default.
To migrate this API to the aclnnQuantMatmulV4 API, perform the following steps:
- x1, x2, and bias can be directly converted to x1, x2, and bias in aclnnQuantMatmulV4.
- If the input deqScale is of the FLOAT type, construct the FLOAT number into a FLOAT aclTensor with the shape of (1,) (for details, see CreateAclTensor in ). Then, use aclnnTransQuantParamV2 to convert the aclTensor into a uint64_t aclTensor with the shape of (1,) (for details, see ). Record it as scale, which corresponds to scale in aclnnQuantMatmulV4.
- Set the optional input offset or pertokenScaleOptional of aclnnQuantMatmulV4 to nullptr, and set transposeX1 and transposeX2 to false.
- Set the API parameters to
[object Object].
The following example is for reference only. For details, see .