From 21c333df8da0d2969924460a085c5c9659a7f2fa Mon Sep 17 00:00:00 2001 From: zhangbo9674 <82555433+zhangbo9674@users.noreply.github.com> Date: Tue, 19 Apr 2022 19:01:54 +0800 Subject: [PATCH] fix setTensorWrapper with no_need_buffers (#41892) (#41952) --- .../auto_code_generator/final_state_generator/eager_gen.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/paddle/fluid/eager/auto_code_generator/final_state_generator/eager_gen.py b/paddle/fluid/eager/auto_code_generator/final_state_generator/eager_gen.py index bd31de52075..82b297acd3d 100644 --- a/paddle/fluid/eager/auto_code_generator/final_state_generator/eager_gen.py +++ b/paddle/fluid/eager/auto_code_generator/final_state_generator/eager_gen.py @@ -730,11 +730,10 @@ class DygraphFunctionGeneratorBase(FunctionGeneratorBase): is_optional = (name in optional_inputs) if is_fwd_input: - need_input_data = "false" if name in self.no_need_buffers else "true" if is_optional: set_tensor_wrappers = f"{indent}if({name}.get_ptr() != nullptr) grad_node->SetTensorWrapper{name}(*({name}.get_ptr()), true);" else: - set_tensor_wrappers = f"{indent}grad_node->SetTensorWrapper{name}({name}, {need_input_data});" + set_tensor_wrappers = f"{indent}grad_node->SetTensorWrapper{name}({name}, true);" set_input_tensor_wrappers_list.append(set_tensor_wrappers) else: if num_fwd_outputs > 1: -- GitLab