Description: Fuses AdaLayerNorm with downstream quantization (only DynamicQuant is supported currently). This operator is used to perform quantization operations on adaptive layer normalization, that is, to normalize the input data and quantize it into low-precision integers to improve the compute efficiency and reduce the memory usage.
Formula:
- Perform LayerNorm normalization on the input x.
- Adjust the normalization result using the adaptive parameters scale and shift.
- If smoothScalesOptional is not empty, then:
- Calculate the maximum absolute value of y and divide the value by 127 to calculate the quantization factor that needs to be quantized into the INT8 format.
- Finally, divide y by the quantization factor and round the quotient off to obtain the quantized output.
E(x) indicates the input's mean value, Var(x) indicates the input's variance, and row_max indicates the maximum value of each row.
Each operator has calls. First, aclnnAdaLayerNormQuantGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnAdaLayerNormQuant is called to perform computation.
Parameters:
[object Object]Returns:
aclnnStatus: status code. For details, see .
The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]
- Deterministic compute:
- aclnnAdaLayerNormQuant defaults to a deterministic implementation.
The following example is for reference only. For details, see .