Description: Adds quantization after the SwiGlu activation function to implement SwiGluQuant computation of the input x.
Operator support: Currently, SwiGluQuant only supports the MoE scenario. The input x and group_index of SwiGluQuant come from the outputs of the GroupedMatMul operator and MoeInitRouting. group_index is used to implement dynamic MoE group quantization, static per_tensor quantization, and static per_channel quantization.
Dynamic quantization formula:
A indicates the first half of the input x, B indicates the second half of the input x, g indicates group_index, and G indicates the number of groups of group_index.
Static quantization formula:
A indicates the first half of the input x, B indicates the second half of the input x, g indicates group_index, and G indicates the number of groups of group_index.
Each operator has calls. First, aclnnSwiGluQuantGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnSwiGluQuant 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]
- Deterministic compute:
- aclnnSwiGluQuant defaults to a deterministic implementation.
The following example is for reference only. For details, see .