Ascend950 arch35 的 SeluGrad 实现与本算子指定竞品 TensorFlow tf.raw_ops.SeluGrad 及 canndev TBE 实现存在语义和计算精度差异:
SeluGrad
tf.raw_ops.SeluGrad
outputs <= 0
outputs == 0
gradients * (outputs + scale * alpha)
outputs < 0
scale * gradients
integer -> FP16 -> FP32
f1628IntegerFlag=True
修复前 TTK 二进制精度对比中,确认存在 18 条整数确定性不一致用例和 2 条 FP16 不一致用例。
cann/ops-nn
activation/selu_grad
aclnnSeluBackward
40f91a7
实现应与 TensorFlow/canndev 契约一致:
outputs < 0 : y = gradients * (outputs + 1.7580993408473768...) outputs >= 0 : y = 1.0507009873554805... * gradients
修复验证结果:
08b4bfdee7fd7812c0085ea4b4f2f7bc0cc6b58b
32dd425aa92f0b0a78a8c5507bcc431b6318e69f
elu_backward(is_result=True)
<= 0
Describe the current behavior / 问题描述 (Mandatory / 必填)
Ascend950 arch35 的
SeluGrad实现与本算子指定竞品 TensorFlowtf.raw_ops.SeluGrad及 canndev TBE 实现存在语义和计算精度差异:outputs <= 0选择负分支,导致outputs == 0时执行gradients * (outputs + scale * alpha);TensorFlow/canndev 的定义是仅当outputs < 0时执行负分支,零点应执行scale * gradients。integer -> FP16 -> FP32,其中 int32 会在 FP16 中转时丢失有效位;int8/uint8 也没有遵循 canndev 在 FP16 域计算的策略。f1628IntegerFlag=True的就近舍入回铸语义。修复前 TTK 二进制精度对比中,确认存在 18 条整数确定性不一致用例和 2 条 FP16 不一致用例。
Environment / 环境信息 (Mandatory / 必填)
cann/ops-nnactivation/selu_grad/aclnnSeluBackward40f91a7tf.raw_ops.SeluGradSteps to reproduce the issue / 重现步骤 (Mandatory / 必填)
activation/selu_grad构建 Ascend950 自定义算子包。tf.raw_ops.SeluGrad作为竞品 Golden;整数输入按 canndev 规则处理:int8/uint8 上浮 FP16,int32 上浮 FP32,计算完成后以 RNE 和饱和语义回铸原 dtype。Describe the expected behavior / 预期结果 (Mandatory / 必填)
实现应与 TensorFlow/canndev 契约一致:
Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
修复验证结果:
Special notes for this issue/备注 (Optional / 选填)
08b4bfdee7fd7812c0085ea4b4f2f7bc0cc6b58b、32dd425aa92f0b0a78a8c5507bcc431b6318e69ftf.raw_ops.SeluGrad与 canndev TBE;outputs == 0的行为有意与 PyTorchelu_backward(is_result=True)的<= 0分支语义区分。