[object Object]

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

    1. Divide [object Object] into two parts:x1=input[...,:d],x2=input[...,d:]x_1 = \text{input}[..., :d], \quad x_2 = \text{input}[..., d:]
    2. Apply the GELU activation function to x1. The formula for the tanh mode corresponding to value tanh is as follows:GELU(x)=0.5x(1+tanh(2π(x+0.044715x3)))\text{GELU}(x) = 0.5 \cdot x \cdot \left( 1 + \tanh\left( \sqrt{\frac{2}{\pi}} \cdot \left( x + 0.044715 x^3 \right) \right) \right) The formula for the erf mode corresponding to value none is as follows:GELU(x)=0.5x(1+erf(x2))\text{GELU}(x) = 0.5 \cdot x \left( 1 + \text{erf}\left( \frac{x}{\sqrt{2}} \right) \right) Thus:x1=GELU(x1)x_1 = \text{GELU}(x_1)
    3. The final output is the element-wise product of x1 and x2:out=x1×x2\text{out} = x_1 \times x_2
[object Object]

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.

[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]
  • 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.

[object Object]

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

[object Object]