From dbb78494dc68ccd962dfc117da1da577e92fb3f6 Mon Sep 17 00:00:00 2001 From: WangXi Date: Wed, 17 Mar 2021 09:26:33 +0000 Subject: [PATCH] fix var in c_reduce_sum --- .../fleet/meta_optimizers/sharding/gradient_clip_helper.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/paddle/distributed/fleet/meta_optimizers/sharding/gradient_clip_helper.py b/python/paddle/distributed/fleet/meta_optimizers/sharding/gradient_clip_helper.py index 4796ad2f1f3..961a789dc08 100644 --- a/python/paddle/distributed/fleet/meta_optimizers/sharding/gradient_clip_helper.py +++ b/python/paddle/distributed/fleet/meta_optimizers/sharding/gradient_clip_helper.py @@ -51,7 +51,8 @@ class GradientClipHelper(object): if deperate_op: deperate_op_idx.add(idx) for output_name in op.desc.output_arg_names(): - deperated_vars.add(output_name) + if output_name not in op.desc.input_arg_names(): + deperated_vars.add(output_name) if not deperated_vars: # got no gradient_clip op @@ -111,7 +112,6 @@ class GradientClipHelper(object): to_check_param - should_check_param) for var_name in deperated_vars: - if block.has_var(var_name): - block._remove_var(var_name, sync=False) + block._remove_var(var_name, sync=False) block._sync_with_cpp() return -- GitLab