| 648 | } |
| 649 | |
| 650 | void Predictor::ClearTensorArray( |
| 651 | const std::shared_ptr<const cpp::ProgramDesc> &program_desc) { |
| 652 | for (size_t blk_idx = 0; blk_idx < program_desc->BlocksSize(); blk_idx++) { |
| 653 | const cpp::BlockDesc *block = |
| 654 | program_desc->GetBlock<cpp::BlockDesc>(blk_idx); |
| 655 | for (size_t var_idx = 0; var_idx < block->VarsSize(); var_idx++) { |
| 656 | const cpp::VarDesc *var = block->GetVar<cpp::VarDesc>(var_idx); |
| 657 | CHECK(var); |
| 658 | |
| 659 | auto *var_ptr = program_->exec_scope()->FindVar(var->Name()); |
| 660 | if (var_ptr->IsType<std::vector<Tensor>>() && |
| 661 | (var->Name() != "feed" && var->Name() != "fetch")) { |
| 662 | std::vector<Tensor> *tensor_array_var = |
| 663 | program_->exec_scope()->FindMutableTensorList(var->Name()); |
| 664 | CHECK(tensor_array_var); |
| 665 | tensor_array_var->clear(); |
| 666 | } |
| 667 | } |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | void Predictor::SetTargetConfigs( |
| 672 | const std::map<TargetType, std::shared_ptr<void>> &target_configs) { |
nothing calls this directly
no test coverage detected