| 541 | } |
| 542 | |
| 543 | void LightPredictor::ClearTensorArray( |
| 544 | const std::shared_ptr<const cpp::ProgramDesc>& program_desc) { |
| 545 | for (size_t blk_idx = 0; blk_idx < program_desc->BlocksSize(); blk_idx++) { |
| 546 | const cpp::BlockDesc* block = |
| 547 | program_desc->GetBlock<cpp::BlockDesc>(blk_idx); |
| 548 | for (size_t var_idx = 0; var_idx < block->VarsSize(); var_idx++) { |
| 549 | const cpp::VarDesc* var = block->GetVar<cpp::VarDesc>(var_idx); |
| 550 | CHECK(var); |
| 551 | |
| 552 | auto* var_ptr = program_->exec_scope()->FindVar(var->Name()); |
| 553 | if (var_ptr->IsType<std::vector<Tensor>>() && |
| 554 | (var->Name() != "feed" && var->Name() != "fetch")) { |
| 555 | std::vector<Tensor>* tensor_array_var = |
| 556 | program_->exec_scope()->FindMutableTensorList(var->Name()); |
| 557 | CHECK(tensor_array_var); |
| 558 | tensor_array_var->clear(); |
| 559 | } |
| 560 | } |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | void LightPredictor::SetTargetConfigs( |
| 565 | const std::map<TargetType, std::shared_ptr<void>>& target_configs) { |
nothing calls this directly
no test coverage detected