From 0604df9e70dfe7be8a21df6a80d9fa6d4939bd9d Mon Sep 17 00:00:00 2001 From: 0x45f <23097963+0x45f@users.noreply.github.com> Date: Wed, 9 Mar 2022 20:40:34 +0800 Subject: [PATCH] [Dy2st]Fix Exception in utils.py function "is_paddle_module" (#40243) --- python/paddle/fluid/dygraph/dygraph_to_static/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/utils.py b/python/paddle/fluid/dygraph/dygraph_to_static/utils.py index 04474dcdfe5..d440e387da5 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/utils.py +++ b/python/paddle/fluid/dygraph/dygraph_to_static/utils.py @@ -191,7 +191,7 @@ def is_api_in_module(node, module_prefix): return eval("_is_api_in_module_helper({}, '{}')".format(func_str, module_prefix)) - except NameError: + except Exception: return False @@ -227,7 +227,7 @@ def is_numpy_api(node): # TODO: find a better way if not module_result: return func_str.startswith("numpy.") or func_str.startswith("np.") - except NameError: + except Exception: return False -- GitLab