Function: The m and v inputs of the optimizer are used as indexes to obtain the values in the qmap, and the values are dequantized by multiplying the corresponding absmax of each blockSize. Then, the AdamW optimizer function is implemented. The maximum value of m and v is selected from each blockSize after the update. Each blockSize of m and v corresponds to an absmax, and normalization is performed once. The index in the qmap corresponding to m and v is found using the binary search method as the output. The absmax is also used as the input for the next quantization.
Optimizer calculation formula:
Each operator has calls. First, aclnnApplyAdamWQuantGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnApplyAdamWQuant 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]
The shape of varRef must meet the following constraints:
- varRef.shape = grad.shape
- varRef.shape = mRef.shape
- varRef.shape = vRef.shape
- varRef.size/blockSize = absmaxMRef.size
- varRef.size/blockSize = absmaxVRef.size
Deterministic compute:
- aclnnApplyAdamWQuant defaults to a deterministic implementation.
The following example is for reference only. For details, see .