[object Object][object Object][object Object]undefined
[object Object]
  • Function: performs matrix multiplication in the fake-quantization scenario with one input. This API supports only the scenario where the right-hand input matrix of matrix multiplication is in FRACTAL_NZ format.
  • Formula:
    • Basic calculation formula:

      y=x@ANTIQUANT(weight)+biasy = x @ ANTIQUANT(weight) + bias

      weightweight is the input in the fake-quantization scenario, and its dequantization formula ANTIQUANT(weight)ANTIQUANT(weight) is as follows:

      ANTIQUANT(weight)=(weight+antiquantOffset)antiquantScaleANTIQUANT(weight) = (weight + antiquantOffset) * antiquantScale
    • Quantization formula when the output needs to be quantized:

      y=QUANT(x@ANTIQUANT(weight)+bias)=(x@ANTIQUANT(weight)+bias)quantScale+quantOffset\begin{aligned} y &= QUANT(x @ ANTIQUANT(weight) + bias) \\ &= (x @ ANTIQUANT(weight) + bias) * quantScale + quantOffset \\ \end{aligned}
[object Object]

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]
[object Object]
  • Parameters

    [object Object]
  • Returns

    [object Object]: status code. For details, see .

    The first-phase API implements input parameter validation. The following error codes may be returned.

    [object Object]
[object Object]
  • Parameters

    [object Object]
  • Returns

    [object Object]: status code. For details, see .

[object Object]
  • Deterministic description: The default deterministic implementation of aclnnWeightQuantBatchMatmulNz is used.
  • The following quantization modes are supported: perchannel , pergroup , and mx .
  • The input and output support the following data type and shape combinations:
    • Ascend 950PR/Ascend 950DT:

      [object Object]undefined
      • The shape of x is (m, k), the shape of y is (m, n), and the shape of biasOptional is null, (1, n), or (n,).
      • If the data type of weight is INT32 or FLOAT, it indicates tightly packed INT4 or FLOAT4_E2M1, which must meet the following constraints:
        • The last dimension of the original ND matrix is 8-byte aligned.
        • Before calling this API, you must use the [object Object] API to convert the sparsely packed INT32/FLOAT to the tightly packed INT4/FLOAT4_E2M1 and the ND to FRACTAL_NZ. For details, see the example (./aclnnConvertWeightToINT4Pack.md).
        • The shape of the FRACTAL_NZ matrix input to this API is (ceil(n/16), ceil(k/16), 16, 2).
        • Weight supports only non-transposition. The shape of the original ND matrix is (k, n).
      • If the data type of weight is INT4 or FLOAT4_E2M1, it must meet the following constraints:
        • The last dimension of the original ND matrix is 2-byte aligned.
        • Before calling this API, you must use the [object Object] API to convert the ND format to the FRACTAL_NZ format. For details, see the .
        • The shape of the FRACTAL_NZ matrix input to this API is (ceil(n/16), ceil(k/16), 16, 16).
        • Weight supports only non-transposition. The shape of the original ND matrix is (k, n).
      • If the data type of weight is INT8, it must meet the following constraints:
        • The shape of the FRACTAL_NZ matrix input to this API is (ceil(n/32), ceil(k/16), 16, 32).
        • k ranges from 1 to 65535, and n ranges from 2 to 65535.
        • Weight supports both transposition and non-transposition. The shape of the original ND matrix is (n, k) or (k, n).
      • The value of m ranges from 1 to 2^31-1.
[object Object]

The following example is for reference only. For details, see .

  • If x is of type float16 and weight is of type float32, the [object Object] API needs to be called to assist the calling. The following is an example:

    [object Object]
  • The following is an example of calling the [object Object] API to assist in calling when x is of type FLOAT16 and weight is of type INT8.

    [object Object]