API function: Quantizes the input x, performs matrix multiplication, and performs dequantization.
Formula:
- If smoothScaleOptional is input, then:
- If xScaleOptional is not input, dynamic quantization is performed, and the x quantization coefficient needs to be computed.
- Quantization
- Matrix multiplication + dequantization
4.1 If the data type of the input is FLOAT32, then:
4.2 If the data type of the input is INT64, then:
Note: In the scenario described in 4.2, the matrix multiplication operation has been performed on and before the input of . Therefore, this step is omitted during internal operator computation. This requires that the scenario must be pertensor static quantization. That is, before input, must be processed as follows to obtain data of the INT64 type:
Each operator has calls. First, aclnnQuantMatmulDequantGetWorkspaceSize is called to obtain the input parameters and compute the required workspace size based on the process. Then, aclnnQuantMatmulDequant is called to perform computation.
Parameters
[object Object]- When the weight parameter is in ND format, the shape is two-dimensional.
- When transposeWeight is set to true, the shape is represented by (n, k).
- When transposeWeight is set to false, the shape is represented by (k, n).
- When the weight parameter is in FRACTAL_NZ format, the shape can be four-dimensional.
- When transposeWeight is set to true, the shape is represented by (k1, n1, n0, k0), where k0 = 32, n0 = 16, and k1 and k of x must meet the following relationship: ceilDiv (k, 32) = k1.
- When transposeWeight is set to false, the shape is represented by (n1, k1, k0, n0), where k0 = 16, n0 = 32, and k1 and k of x must meet the following relationship: ceilDiv (k, 16) = k1.
- aclnnCalculateMatmulWeightSizeV2 and aclnnTransMatmulWeight can be used to convert the input format from ND to FRACTAL_NZ.
- When the weight parameter is in ND format, the shape is two-dimensional.
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 training products[object Object] and [object Object]Atlas inference products[object Object]: aclnnQuantMatmulDequant defaults to a deterministic implementation.
n and k must be integer multiples of 16.
If the data type of weightScale is INT64, the data type of xScaleOptional must be FLOAT16 and the value of xQuantMode must be pertensor. If the data type of xScaleOptional is FLOAT16, the data type of weightScale must be INT64 and the value of xQuantMode must be pertensor.
The following example is for reference only. For details, see .