From 38c27d553f2024bf5ea9ae850c5a2cb83476c5e2 Mon Sep 17 00:00:00 2001 From: Yuang Liu Date: Tue, 31 Aug 2021 12:31:33 +0800 Subject: [PATCH] [cherry-pick] NPU use squared_l2_norm in GradientClipByGlobalNorm (#34836) (#35289) Co-authored-by: WangXi --- python/paddle/fluid/clip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/fluid/clip.py b/python/paddle/fluid/clip.py index 04fb45cd3ae..d48cea48a76 100644 --- a/python/paddle/fluid/clip.py +++ b/python/paddle/fluid/clip.py @@ -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 -- GitLab