[object Object]

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

    mt=β1mt1+(1β1)gtm_{t}=\beta_{1} m_{t-1}+\left(1-\beta_{1}\right) g_{t} \\ vt=β2vt1+(1β2)gt2v_{t}=\beta_{2} v_{t-1}+\left(1-\beta_{2}\right) g_{t}^{2} m^t=mt1β1t\hat{m}_{t}=\frac{m_{t}}{1-\beta_{1}^{t}} \\ v^t=vt1β2t\hat{v}_{t}=\frac{v_{t}}{1-\beta_{2}^{t}} \\ θt+1=θtηv^t+ϵm^tηλθt1\theta_{t+1}=\theta_{t}-\frac{\eta}{\sqrt{\hat{v}_{t}}+\epsilon} \hat{m}_{t}-\eta \cdot \lambda \cdot \theta_{t-1}
[object Object]

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.

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

    [object Object]
  • Returns:

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

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

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

[object Object]