Skip to content

Commit

Permalink
[Eager] Fix multiprocessing eager mode global issue (#41645) (#41690)
Browse files Browse the repository at this point in the history
  • Loading branch information
veyron95 authored Apr 13, 2022
1 parent acb1382 commit 6dc95b8
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
import time
import paddle
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
HAS_SHM_FILES = os.path.isdir('/dev/shm')


def fill_tensor(queue, event):
# make sure run in legacy dygraph
if in_dygraph_mode():
_enable_legacy_dygraph()
data = queue.get()
with paddle.no_grad():
data[0][:] = 5
Expand Down

0 comments on commit 6dc95b8

Please sign in to comment.