昇腾社区首页
中文
注册
开发者
下载

aclnnGeGluBackward

产品支持情况

[object Object]undefined

功能说明

  • 接口功能:完成的反向。
  • 计算公式:gradOutput=[b1b2bN],self=[a11a12a1Na21a22a2NaM1aM2aMN],gelu=[a11a12a1N/2a21a22a2N/2]\text{gradOutput} = \begin{bmatrix} b_1 \\ b_2 \\ \vdots \\ b_N \end{bmatrix}, \quad \text{self} = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1N} \\ a_{21} & a_{22} & \cdots & a_{2N} \\ \vdots & \vdots & \ddots & \vdots \\ a_{M1} & a_{M2} & \cdots & a_{MN} \end{bmatrix}, \quad gelu = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1N/2} \\ a_{21} & a_{22} & \cdots & a_{2N/2} \end{bmatrix} dim=the dimension along which chunk is performed,approximate = ’approximate’\text{dim} = \text{the dimension along which chunk is performed}, \quad \text{approximate = 'approximate'} 输出:gradInput=[b1y_gelu1b2y_gelu2bNy_geluN]\text{gradInput} = \begin{bmatrix} b_1 \cdot y\_gelu_1 & b_2 \cdot y\_gelu_2 & \cdots & b_N \cdot y\_gelu_N \end{bmatrix}

函数原型

每个算子分为,必须先调用“aclnnGeGluBackwardGetWorkspaceSize”接口获取计算所需workspace大小以及包含了算子计算流程的执行器,再调用“aclnnGeGluBackward”接口执行计算。

[object Object]
[object Object]

aclnnGeGluBackwardGetWorkspaceSize

  • 参数说明:

    [object Object]
    • [object Object]Atlas 推理系列产品[object Object]、[object Object]Atlas 训练系列产品[object Object]:数据类型支持FLOAT32、FLOAT16。
  • 返回值:

    aclnnStatus:返回状态码,具体参见。 第一段接口会完成入参校验,出现以下场景时报错:

    [object Object]

aclnnGeGluBackward

  • 参数说明:

    [object Object]
  • 返回值:

    aclnnStatus:返回状态码,具体参见

约束说明

  • 确定性计算:
    • aclnnGeGluBackward默认确定性实现。

调用示例

示例代码如下,仅供参考,具体编译和执行过程请参考

[object Object]