MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle-Lite / ClearTensorArray

Method ClearTensorArray

lite/api/cxx_api.cc:650–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648}
649
650void 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
671void Predictor::SetTargetConfigs(
672 const std::map<TargetType, std::shared_ptr<void>> &target_configs) {

Callers

nothing calls this directly

Calls 7

FindVarMethod · 0.80
FindMutableTensorListMethod · 0.80
BlocksSizeMethod · 0.45
VarsSizeMethod · 0.45
exec_scopeMethod · 0.45
NameMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected