From 6bad30096df28a5293f335998ae1e6d03371daee Mon Sep 17 00:00:00 2001 From: zhangbo9674 <82555433+zhangbo9674@users.noreply.github.com> Date: Mon, 18 Apr 2022 19:09:23 +0800 Subject: [PATCH] fix setTensorWrapper with no_need_buffers (#41892) --- .../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