diff --git a/python/paddle/hapi/model.py b/python/paddle/hapi/model.py index c50b3c06bdff07e73e12353d8625d6c04e4a2771..a1fe1f58643326c5eea2552f3835724610b7378f 100644 --- a/python/paddle/hapi/model.py +++ b/python/paddle/hapi/model.py @@ -218,8 +218,6 @@ def prepare_distributed_context(place=None): fluid.disable_dygraph() _init_context() fluid.enable_dygraph(place) - else: - _init_context() else: assert ("Only support CUDAPlace for now.") diff --git a/python/paddle/tests/dist_hapi_mnist_static.py b/python/paddle/tests/dist_hapi_mnist_static.py index eab34a6dafbc354a24aa51e93a9fec9efc3b3cee..6120ae90e994d27bdcae4f44da04ce7dc4da0e31 100644 --- a/python/paddle/tests/dist_hapi_mnist_static.py +++ b/python/paddle/tests/dist_hapi_mnist_static.py @@ -59,6 +59,7 @@ def compute_accuracy(pred, gt): 'CPU testing is not supported') class TestDistTraning(unittest.TestCase): def test_static_multiple_gpus(self): + paddle.enable_static() device = set_device('gpu') im_shape = (-1, 1, 28, 28)