Skip to content

Commit

Permalink
fix 2 bug: 1.skip lodtensorarray; 2.delete feed op (#37090)
Browse files Browse the repository at this point in the history
* fix 2 bug: 1.skip lodtensorarray; 2.delete feed op, test=develop

* program clone, test=develop
  • Loading branch information
wanghuancoder authored Nov 11, 2021
1 parent 8395f57 commit d5df6bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions paddle/fluid/framework/new_executor/interpretercore_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ std::vector<OpFuncNode> 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<LoDTensor>() || var->IsType<SelectedRows>())) {
continue;
}
auto& var_name = inputs_names[var_name_item.first].at(i);
auto tensor_in = GetLoDTensorOrSelectedRowsValueFromVar(*var);
if (!tensor_in->IsInitialized()) {
Expand Down
5 changes: 4 additions & 1 deletion python/paddle/fluid/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
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']

Expand Down Expand Up @@ -598,7 +599,9 @@ def _get_exe_from_cache(self, program, scope):
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]
Expand Down

0 comments on commit d5df6bd

Please sign in to comment.