From 13991b5e483ea3319a4b559e854bb055552097a0 Mon Sep 17 00:00:00 2001 From: Jiaqi Liu Date: Thu, 22 Jul 2021 10:53:31 +0800 Subject: [PATCH] fix hapi fleet bug in static mode (#34311) --- python/paddle/hapi/model.py | 2 -- python/paddle/tests/dist_hapi_mnist_static.py | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/python/paddle/hapi/model.py b/python/paddle/hapi/model.py index c50b3c06bd..a1fe1f5864 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 eab34a6daf..6120ae90e9 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) -- GitLab