未验证 提交 aa342a2d 编写于 作者: A Aurelius84 提交者: GitHub

Add six for @to_static and add CI approval (#47575)

* Add six for @to_static and add CI approval

* add six

* refine logic

* delete approve

* fix return

* add ImportError

* typo `moduels` -> `modules`
Co-authored-by: NNyakku Shigure <sigure.qaq@gmail.com>
上级 a7509ce3
......@@ -50,16 +50,7 @@ from paddle.fluid.dygraph.layers import Layer
__all__ = ["convert_call"]
# TODO(liym27): A better way to do this.
BUILTIN_LIKELY_MODULES = [
collections,
pdb,
copy,
inspect,
re,
numpy,
logging,
]
# The api(s) should be considered as plain function and convert
# them into static layer code.
PADDLE_NEED_CONVERT_APIS = [Sequential]
......@@ -99,6 +90,32 @@ def is_builtin(func, name=None):
return False
def builtin_modules():
"""
Return builtin modules.
"""
modules = [
collections,
pdb,
copy,
inspect,
re,
numpy,
logging,
]
try:
import six
modules.append(six)
except ImportError:
pass # do nothing
return modules
BUILTIN_LIKELY_MODULES = builtin_modules()
def is_unsupported(func):
"""
Checks whether the func is supported by dygraph to static graph.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册