未验证 提交 5f65d9d5 编写于 作者: H hong 提交者: GitHub

Fix dygraph exit issue (#24347)

* add clean up; test=develop

* add import; test=develop
上级 1ed8baf9
...@@ -19,6 +19,7 @@ import sys ...@@ -19,6 +19,7 @@ import sys
import numpy as np import numpy as np
from paddle.fluid import core from paddle.fluid import core
from paddle.fluid import framework from paddle.fluid import framework
from paddle.fluid.multiprocess_utils import CleanupFuncRegistrar
from .tracer import Tracer from .tracer import Tracer
import logging import logging
import objgraph import objgraph
...@@ -134,6 +135,9 @@ def enable_dygraph(place=None): ...@@ -134,6 +135,9 @@ def enable_dygraph(place=None):
_functional_dygraph_context_manager = guard(place=place) _functional_dygraph_context_manager = guard(place=place)
_functional_dygraph_context_manager.__enter__() _functional_dygraph_context_manager.__enter__()
# call disable_dygraph when Python exit
CleanupFuncRegistrar.register(disable_dygraph)
def disable_dygraph(): def disable_dygraph():
""" """
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册