Skip to content

Commit

Permalink
fix import fluid error in dygraph_to_static. test=develop (PaddlePadd…
Browse files Browse the repository at this point in the history
  • Loading branch information
wzzju authored Jul 2, 2020
1 parent b0f1894 commit dc17ac9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/paddle/fluid/dygraph/dygraph_to_static/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ def ast_to_func(ast_root, dyfunc, delete_on_exit=True):
function, the other inner functions are invisible for the decorated function.
"""
source = ast_to_source_code(ast_root)
import_fluid = "import paddle.fluid as fluid\n"
source = import_fluid + source
if six.PY2:
source = source.encode('utf-8')
f = tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False)
Expand Down

0 comments on commit dc17ac9

Please sign in to comment.