Description:
Divides the input tensor into two tensors x1 and x2 based on the last dimension, performs Gelu computation on x1, and multiplies the computation result by x2.
Formula:
Given an input tensor
[object Object]with the last dimension length of[object Object], the[object Object]function performs the following computation:- Divide
[object Object]into two parts: - Apply the GELU activation function to x1. The formula for the tanh mode corresponding to value tanh is as follows: The formula for the erf mode corresponding to value none is as follows: Thus:
- The final output is the element-wise product of x1 and x2:
- Divide
Each operator has calls. First, aclnnGeluMulGetWorkspaceSize is called to obtain the input parameters and compute the required workspace size based on the process. Then, aclnnGeluMul 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 computation:
- aclnnGeluMul defaults to a deterministic implementation.
For typical scenarios where the last axis is a multiple of 16, if the last axis is not 32-byte aligned, the small-operator tiling logic is recommended.
The following example is for reference only. For details, see .