From 1fa98c5d9ea159ee2c39de827d19fa476ba3cd9c Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Sun, 10 Jan 2021 20:44:21 -0600 Subject: [PATCH] [Cherry-pick] remove distributed prepare context (#30219) (#30256) att, cherry-pick of #30219 --- python/paddle/distributed/__init__.py | 2 -- .../paddle/fluid/tests/unittests/test_directory_migration.py | 3 +-- .../fluid/tests/unittests/test_imperative_data_parallel.py | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/python/paddle/distributed/__init__.py b/python/paddle/distributed/__init__.py index 9730e9f95b6..155037030b5 100644 --- a/python/paddle/distributed/__init__.py +++ b/python/paddle/distributed/__init__.py @@ -19,7 +19,6 @@ from . import parallel from .parallel import init_parallel_env from .parallel import get_rank from .parallel import get_world_size -from paddle.fluid.dygraph.parallel import prepare_context #DEFINE_ALIAS from paddle.fluid.dygraph.parallel import ParallelEnv #DEFINE_ALIAS from paddle.distributed.fleet.dataset import * @@ -34,7 +33,6 @@ __all__ += [ "init_parallel_env", "get_rank", "get_world_size", - "prepare_context", "ParallelEnv", "InMemoryDataset", "QueueDataset", diff --git a/python/paddle/fluid/tests/unittests/test_directory_migration.py b/python/paddle/fluid/tests/unittests/test_directory_migration.py index 72df01ac1bc..2ec16a9dcab 100644 --- a/python/paddle/fluid/tests/unittests/test_directory_migration.py +++ b/python/paddle/fluid/tests/unittests/test_directory_migration.py @@ -38,8 +38,7 @@ class TestDirectory(unittest.TestCase): 'paddle.enable_static', 'paddle.disable_static', 'paddle.in_dynamic_mode', 'paddle.to_tensor', 'paddle.grad', 'paddle.no_grad', 'paddle.static.save', 'paddle.static.load', - 'paddle.distributed.ParallelEnv', - 'paddle.distributed.prepare_context', 'paddle.DataParallel', + 'paddle.distributed.ParallelEnv', 'paddle.DataParallel', 'paddle.jit', 'paddle.jit.TracedLayer', 'paddle.jit.to_static', 'paddle.jit.ProgramTranslator', 'paddle.jit.TranslatedLayer', 'paddle.jit.save', 'paddle.jit.load', diff --git a/python/paddle/fluid/tests/unittests/test_imperative_data_parallel.py b/python/paddle/fluid/tests/unittests/test_imperative_data_parallel.py index 428f97c0af8..d645a0a5ceb 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_data_parallel.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_data_parallel.py @@ -43,7 +43,7 @@ class MLP(fluid.Layer): class TestDataParallelStateDict(unittest.TestCase): def test_data_parallel_state_dict(self): with fluid.dygraph.guard(): - strategy = paddle.distributed.prepare_context() + strategy = dygraph.parallel.prepare_context() mlp = MLP() parallel_mlp = dygraph.parallel.DataParallel(mlp, strategy) -- GitLab