From d5df6bdf26458653af557443324f7f7c664dccd6 Mon Sep 17 00:00:00 2001 From: wanghuancoder Date: Thu, 11 Nov 2021 09:56:14 +0800 Subject: [PATCH] fix 2 bug: 1.skip lodtensorarray; 2.delete feed op (#37090) * fix 2 bug: 1.skip lodtensorarray; 2.delete feed op, test=develop * program clone, test=develop --- paddle/fluid/framework/new_executor/interpretercore_util.cc | 3 +++ python/paddle/fluid/executor.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/framework/new_executor/interpretercore_util.cc b/paddle/fluid/framework/new_executor/interpretercore_util.cc index acf0b4b30c..972c8c19dd 100644 --- a/paddle/fluid/framework/new_executor/interpretercore_util.cc +++ b/paddle/fluid/framework/new_executor/interpretercore_util.cc @@ -379,6 +379,9 @@ std::vector apply_data_transform( for (auto& var_name_item : *ins_map_temp) { for (size_t i = 0; i < var_name_item.second.size(); ++i) { auto var = var_name_item.second[i]; + if (!(var->IsType() || var->IsType())) { + continue; + } auto& var_name = inputs_names[var_name_item.first].at(i); auto tensor_in = GetLoDTensorOrSelectedRowsValueFromVar(*var); if (!tensor_in->IsInitialized()) { diff --git a/python/paddle/fluid/executor.py b/python/paddle/fluid/executor.py index dd5744203d..ad59ff6579 100644 --- a/python/paddle/fluid/executor.py +++ b/python/paddle/fluid/executor.py @@ -34,6 +34,7 @@ from .trainer_factory import FetchHandlerMonitor import copy from . import framework from .incubate.checkpoint import auto_checkpoint as acp +from .compiler import _prune_feed_ops __all__ = ['Executor', 'global_scope', 'scope_guard'] @@ -598,7 +599,9 @@ class _ExecutorCache(object): program, Program), "Required type(Program), but received {}".format( type(program).__name__) if program not in self._cached_executors: - new_exe = _StandaloneExecutor(self._place, program, scope) + new_program = program.clone() + _prune_feed_ops(new_program) + new_exe = _StandaloneExecutor(self._place, new_program, scope) self._cached_executors[program] = new_exe return self._cached_executors[program] -- GitLab