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

Function LoadModelNaiveFromMemory

lite/model_parser/model_parser.cc:700–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

698}
699
700void LoadModelNaiveFromMemory(const std::string &model_buffer,
701 const std::string &param_buffer,
702 Scope *scope,
703 cpp::ProgramDesc *cpp_prog) {
704 CHECK(cpp_prog);
705 CHECK(scope);
706 cpp_prog->ClearBlocks();
707
708 // Load model
709 naive_buffer::BinaryTable table;
710 table.LoadFromMemory(model_buffer.c_str(), model_buffer.length());
711
712 naive_buffer::proto::ProgramDesc nb_proto_prog(&table);
713 nb_proto_prog.Load();
714 naive_buffer::ProgramDesc nb_prog(&nb_proto_prog);
715
716 // Transform to cpp::ProgramDesc
717 TransformProgramDescAnyToCpp(nb_prog, cpp_prog);
718
719 // Load Params
720 LoadCombinedParamsNaive(param_buffer, 0, scope, *cpp_prog, true);
721
722 VLOG(4) << "Load model from naive buffer memory successfully";
723}
724#endif // LITE_ON_TINY_PUBLISH
725
726/*

Callers 2

BuildMethod · 0.85
TESTFunction · 0.85

Calls 9

LoadCombinedParamsNaiveFunction · 0.85
LoadModelFbsFromMemoryFunction · 0.85
LoadFromMemoryMethod · 0.80
LoadMethod · 0.60
ClearBlocksMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45
ReadMethod · 0.45

Tested by 1

TESTFunction · 0.68