SoftmaxGrad
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR/Ascend 950DT | √ |
| Atlas A3 训练系列产品/Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品/Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | × |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
功能说明
-
接口功能:完成softmax的反向传播。
-
计算公式:对于Softmax函数的求导,可以使用以下公式: gradOutput(上一层输出梯度)、output(Softmax正向输出)的关系可表示如下:
out=gradOutput⋅output−sum(gradOutput⋅output)⋅outputout = gradOutput \cdot output - sum(gradOutput \cdot output)\cdot output
-
参数说明:
参数名 输入/输出/属性 描述 数据类型 数据格式 gradOutput 输入 反向传播的梯度值,即上一层的输出梯度。公式中的gradOutput。 FLOAT16、FLOAT32、BFLOAT16 ND output 输入 Softmax函数的输出值,公式中的output。 FLOAT16、FLOAT32、BFLOAT16 ND dim 输入 Softmax函数的维度。 INT64 - out 输出 函数的输出是输入的梯度值。 FLOAT16、FLOAT32、BFLOAT16 ND - Atlas 推理系列产品、Atlas 训练系列产品:数据类型支持FLOAT16、FLOAT32。
约束说明
无
调用说明
| 调用方式 | 调用样例 | 说明 |
|---|---|---|
| aclnn调用 | test_aclnn_softmax_grad | 通过aclnnSoftmaxBackward接口方式调用SoftmaxGrad算子。 |