- Description: Adds dequantization and quantization operations before and after the Swish-gated linear unit (SwiGLU) activation function, performing DequantSwiGLUQuant computation on input x.
- Formula: Where A is the first half of dequantOut and B is the second half of dequantOut.
Each operator has calls. First, aclnnDequantSwigluQuantGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation flow. Then, aclnnDequantSwigluQuant is called to perform computation.
Parameters
[object Object]- weightScaleOptional:
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: The data type can be FLOAT and the shape can be 1D, denoted as [H], where H must equal the last dimension of x. This parameter is optional and can be a null pointer.
- activationScaleOptional:
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: The data type can be FLOAT and the shape is [N..., 1], where the last dimension is 1 and the remaining dimensions are the same as x. This parameter is optional and can be a null pointer.
- quantScaleOptional:
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: The data type can be FLOAT or FLOAT16. When quantModeOptional is static, the shape is 1D with value 1, represented as shape[1]. When quantModeOptional is dynamic, the shape is 1D with value equal to half the last dimension of x, represented as shape[H/2]. This parameter is optional and can be a null pointer.
- quantOffsetOptional:
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: The data type can be FLOAT. When quantModeOptional is static, the shape is 1D with value 1, represented as shape[1]. When quantModeOptional is dynamic, the shape is 1D with value equal to half the last dimension of x, represented as shape[H/2]. This parameter is optional and can be a null pointer.
- groupIndexOptional:
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: The data type can be INT32 or INT64, and the shape can be a 1D tensor. This parameter is optional and can be a null pointer.
- quantModeOptional:
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: "dynamic" and "static" are supported.
- yOut:
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: The data type can be INT8.
- scaleOut:
- [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: The data type can be FLOAT.
- weightScaleOptional:
Returns
aclnnStatus: status code. For details, see . The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]- Parameters
Deterministic computation:
- aclnnDequantSwigluQuant defaults to a deterministic implementation.
[object Object]Atlas A2 training products/Atlas A2 inference products[object Object]:
- The last dimension of x must be a multiple of 2, and x must have at least two dimensions.
- When quantModeOptional is static, quantScaleOptional and quantOffsetOptional are 1D with a value of 1. When quantModeOptional is dynamic, quantScaleOptional and quantOffsetOptional are 1D with a value equal to half the last dimension of x.
[object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The operator imposes an upper limit on the memory size of supported input tensors. The validation formula is: Memory size of weightScaleOptional + Memory size of biasOptional + Memory size of quantScaleOptional + Memory size of quantOffsetOptional + (Memory size of activationScaleOptional + Memory size of scaleOut)/40 + 10 × Memory size of the last dimension H of x < 192 KB.
The following example is for reference only. For details, see .