Skip to content

Commit 49f9e3f

Browse files
authored
fix ClearTensorArray; (#7286)
1 parent f192e56 commit 49f9e3f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lite/api/light_api.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,9 @@ void LightPredictor::ClearTensorArray(
401401
const cpp::VarDesc* var = block->GetVar<cpp::VarDesc>(var_idx);
402402
CHECK(var);
403403

404-
auto tmp = program_->exec_scope()->FindVar(var->Name());
405-
if (tmp->IsType<std::vector<Tensor>>()) {
404+
auto* var_ptr = program_->exec_scope()->FindVar(var->Name());
405+
if (var_ptr->IsType<std::vector<Tensor>>() &&
406+
(var->Name() != "feed" && var->Name() != "fetch")) {
406407
std::vector<Tensor>* tensor_array_var =
407408
program_->exec_scope()->FindMutableTensorList(var->Name());
408409
CHECK(tensor_array_var);

0 commit comments

Comments
 (0)