diff --git a/paddle/fluid/framework/new_executor/interpretercore_util.cc b/paddle/fluid/framework/new_executor/interpretercore_util.cc index acf0b4b30c78119da105e6887543e49605eae1b8..972c8c19dd40507e76c65d525bb106910eaa7b4f 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 dd5744203d54769f14e57f2aaf909f6d06fdb756..ad59ff657971c21659c4f1d9965a4024ff177ea5 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]