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

Method ClearTensorArray

lite/api/light_api.cc:543–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

541}
542
543void 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
564void LightPredictor::SetTargetConfigs(
565 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