From e63826436ea7b17e9c6590d47b8967f55963e17f Mon Sep 17 00:00:00 2001 From: zhhsplendid Date: Sun, 27 Sep 2020 12:53:33 +0000 Subject: [PATCH] Simplify code, test=develop --- .../dygraph_to_static/convert_call_func.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/convert_call_func.py b/python/paddle/fluid/dygraph/dygraph_to_static/convert_call_func.py index a62b815975e..57c36e80fda 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/convert_call_func.py +++ b/python/paddle/fluid/dygraph/dygraph_to_static/convert_call_func.py @@ -65,24 +65,17 @@ def is_unsupported(func): Checks whether the func is supported by dygraph to static graph. """ - func_in_builtin_modules = False for m in BUILTIN_LIKELY_MODULES: for v in m.__dict__.values(): func_in_dict = func == v if isinstance(func_in_dict, (list, numpy.ndarray)): func_in_dict = any(func_in_dict) if func_in_dict: - func_in_builtin_modules = True - break - if func_in_builtin_modules: - break - - if func_in_builtin_modules: - translator_logger.log( - 2, - "Whitelist: {} is part of built-in module and does not have to be transformed.". - format(func)) - return True + translator_logger.log( + 2, + "Whitelist: {} is part of built-in module and does not have to be transformed.". + format(func)) + return True if is_paddle_func(func): translator_logger.log( -- GitLab