diff --git a/python/paddle/fluid/parallel_executor.py b/python/paddle/fluid/parallel_executor.py index c55bc46cc9e132c9be0b4fea25c13b789c4e6819..da18b4e51f206a1983bf368d0044a6442ab2fbac 100644 --- a/python/paddle/fluid/parallel_executor.py +++ b/python/paddle/fluid/parallel_executor.py @@ -135,7 +135,6 @@ class ParallelExecutor(object): # step3: init build_strategy if build_strategy is None: build_strategy = BuildStrategy() - build_strategy.enable_inplace = False if main._is_optimized else True build_strategy.num_trainers = num_trainers build_strategy.trainer_id = trainer_id # FIXME(zcd): is_distribution_ is a temporary field, because in pserver mode, @@ -147,6 +146,9 @@ class ParallelExecutor(object): # step4: get main_program, scope, local_scopes main = main_program if main_program \ else framework.default_main_program() + # FIXME(dzhwinter): enable_inplace should be after memory_optimize + # if turn on python memory optimize, turn off the inplace_pass. + build_strategy.enable_inplace = False if main._is_optimized else True scope = scope if scope is not None else executor.global_scope() if share_vars_from and not isinstance(share_vars_from,