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 0d1d3ab7225227d44d98a11f8a6511d0d8a43c19..88688672b18b58ce1ecd9301a3dc0d5571275f9c 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 d3c3177827b28d7806dac63709ce115ac34741da..14f22fced9230244088c7c46b65031d95769ba3c 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: