diff --git a/python/paddle/fluid/compiler.py b/python/paddle/fluid/compiler.py index 14ca922a345b51ed69c543cbc67b6d8ea702f1e9..49c4c4f246c4dbac5ef0444cfcf12b64ca259717 100644 --- a/python/paddle/fluid/compiler.py +++ b/python/paddle/fluid/compiler.py @@ -240,8 +240,6 @@ class CompiledProgram(object): "share_vars_from is not compiled and run, so there is no " "var to share.") self._local_scopes = self._share_vars_from._executor.local_scopes() - # drop the local_exe_scopes of the previous parallel_executor - self._share_vars_from._executor.drop_local_exe_scopes() else: assert scope is not None, "" self._local_scopes = [] diff --git a/python/paddle/fluid/parallel_executor.py b/python/paddle/fluid/parallel_executor.py index 479894132f5dcc35ca17fa1faeb5cc032fa88f51..b1594ee202874403c1aa4af06768151486a65946 100644 --- a/python/paddle/fluid/parallel_executor.py +++ b/python/paddle/fluid/parallel_executor.py @@ -163,6 +163,7 @@ class ParallelExecutor(object): assert isinstance( share_vars_from, ParallelExecutor ), "The share_vars_from should be ParallelExecutor." + self._compiled_program.with_data_parallel( loss_name=loss_name, build_strategy=build_strategy, @@ -172,7 +173,6 @@ class ParallelExecutor(object): self._place = core.CUDAPlace(0) if use_cuda else core.CPUPlace() self._exe = executor.Executor(self._place) - self._compiled_program._compile(place=self._place, scope=self._scope) def run(self, fetch_list, feed=None, feed_dict=None, return_numpy=True): """