[object Object]

[object Object][object Object]undefined
[object Object]
  • Description: Performs backpropagation of .

  • Formula:

    Gelu forward (x can be a scalar or tensor):

    Gelu(x)=xΦ(x)=x/2[1+erf(x/2)]Gelu(x)=x \cdot \Phi(x)=x/2 \cdot [1+erf(x/\sqrt{2})]

    The formula of erf is as follows:

    erf(x)=2πn=0(1)nx2n+1n!(2n+1)erf(x)=\frac{2}{\sqrt \pi}\sum^{\infty}_{n=0}{\frac{(-1)^n \cdot x^{2n+1}}{n! \cdot (2n+1)}}

    The relationship between gradInput and gradOutput can be expressed as follows:

    gradInput=gradOutput(12+12erf(x2)+x2πex22)gradInput = gradOutput \cdot (\frac{1}{2}+\frac{1}{2} \cdot erf(\frac{x}{\sqrt2})+\frac{x}{\sqrt{2\pi}} \cdot e^{-\frac{x^2}{2}})

    The approximate formula of Gelu is as follows:

    Gelu(x)=0.5x(1+tanh(2/π(x+0.044715x3)))Gelu(x)=0.5x(1+tanh(\sqrt{2/\pi}(x+0.044715x^3)))
[object Object]

Each operator has calls. First, aclnnGeluBackwardGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnGeluBackward is called to perform computation.

[object Object]
[object Object]
[object Object]
  • Parameters:

    [object Object]
    • [object Object]Atlas inference products[object Object] and [object Object]Atlas training products[object Object]: The data type can be FLOAT or FLOAT16.
  • 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:
    • aclnnGeluBackward defaults to a deterministic implementation.
[object Object]

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

[object Object]