未验证 提交 606848af 编写于 作者: W Weilong Wu 提交者: GitHub

[Eager] Fix multiprocessing eager mode global issue (#41645)

上级 b01314c5
...@@ -19,13 +19,16 @@ import unittest ...@@ -19,13 +19,16 @@ import unittest
import time import time
import paddle import paddle
import paddle.incubate.multiprocessing as mp import paddle.incubate.multiprocessing as mp
from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph, in_dygraph_mode from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph, in_dygraph_mode, _enable_legacy_dygraph
REPEAT = 20 REPEAT = 20
HAS_SHM_FILES = os.path.isdir('/dev/shm') HAS_SHM_FILES = os.path.isdir('/dev/shm')
def fill_tensor(queue, event): def fill_tensor(queue, event):
# make sure run in legacy dygraph
if in_dygraph_mode():
_enable_legacy_dygraph()
data = queue.get() data = queue.get()
with paddle.no_grad(): with paddle.no_grad():
data[0][:] = 5 data[0][:] = 5
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册