- This API is used to quantize the input x based on the input scale and offset. The size of the scale and offset must be the last dimension or 1 of x.
- Formula:
When sqrtMode is false, the calculation formula is as follows:
When sqrtMode is true, the calculation formula is as follows:
Each operator has calls. First, aclnnAscendQuantGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnAscendQuant is called to perform computation.
Parameters:
[object Object][object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]:
- When the data format of x, scale, and offset is NZ, the data type can only be FLOAT32.
- When the data format is NZ, the data type of the output parameter
[object Object]supports INT32.
[object Object]Atlas inference products[object Object]:
- The data types of the input parameters x, scale, and offset do not support BFLOAT16, and the data format cannot be NZ.
- The data type of the output parameter y can only be INT8, and the data format cannot be NZ.
- The input parameter
[object Object]can only be set to 2, indicating INT8.
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 compute:
- aclnnAscendQuant defaults to a deterministic implementation.
The following example is for reference only. For details, see .