From 2bc72a06be7a2df79b2324bc97ea6eb5f3c847b3 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Sun, 3 Apr 2022 13:27:41 +0800 Subject: [PATCH] fix eager gen grad multi out error (#41358) --- .../auto_code_generator/final_state_generator/eager_gen.py | 4 ++-- python/paddle/utils/code_gen/api_base.py | 2 +- 2 files changed, 3 insertions(+), 3 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 0d1d3ab722..88688672b1 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 @@ -88,9 +88,9 @@ VECTOR_TENSOR_MEMBER_TEMPLATE = \ CLEAR_VECTOR_TENSOR_WRAPPERS_TEMPLATE = \ """ - for (auto tw: {}) { + for (auto& tw : {}) {{ tw.clear(); - }; + }} """ SET_ATTR_METHOD_TEMPLATE = \ diff --git a/python/paddle/utils/code_gen/api_base.py b/python/paddle/utils/code_gen/api_base.py index d3c3177827..14f22fced9 100644 --- a/python/paddle/utils/code_gen/api_base.py +++ b/python/paddle/utils/code_gen/api_base.py @@ -193,7 +193,7 @@ class BaseAPI(object): f"{api_name} : Output type error: the output type only support Tensor and Tensor[], \ but now is {out_type}." - return out_type, result.group('name') + return output_type_map[out_type], result.group('name') else: if output_item.strip() in output_type_map: -- GitLab