未验证 提交 38c27d55 编写于 作者: Y Yuang Liu 提交者: GitHub

[cherry-pick] NPU use squared_l2_norm in GradientClipByGlobalNorm (#34836) (#35289)

Co-authored-by: NWangXi <wangxi16@baidu.com>
上级 52a7b0c4
......@@ -40,7 +40,7 @@ def _squared_l2_norm(x):
This OP returns the squared L2 norm of a tensor.
"""
if core.is_compiled_with_npu() or core.is_compiled_with_xpu():
if core.is_compiled_with_xpu():
square = layers.square(x)
sum_square = layers.reduce_sum(square)
return sum_square
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册