MCPcopy Create free account
hub / github.com/OAID/Tengine / LoadModel

Method LoadModel

tengine-module/plugin/serializer/mxnet/mxnet_serializer.cpp:452–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452bool MxnetSerializer::LoadModel(const std::vector<std::string>& file_list, StaticGraph* graph)
453{
454 if(file_list.size() != GetFileNum())
455 return false;
456
457 std::vector<MxnetNode> nodelist;
458 if(!LoadTextFile(file_list[0].c_str(), nodelist))
459 {
460 LOG_ERROR() << "Parse text file " << file_list[0].c_str() << " failed\n";
461 return false;
462 }
463
464 std::vector<MxnetParam> paramlist;
465 if(!LoadBinaryFile(file_list[1].c_str(), paramlist))
466 {
467 LOG_ERROR() << "Parse binary file " << file_list[1].c_str() << " failed\n";
468 return false;
469 }
470
471 SetGraphSource(graph, file_list[1]);
472 SetGraphSourceFormat(graph, "mxnet");
473 SetGraphConstTensorFile(graph, file_list[1]);
474 SetGraphLayout(graph, TENGINE_LAYOUT_NCHW);
475 SetModelLayout(graph, TENGINE_LAYOUT_NCHW);
476 SetModelFormat(graph, MODEL_FORMAT_MXNET);
477
478 bool res = LoadGraph(graph, nodelist, paramlist);
479 for(std::size_t ii = 0; ii < paramlist.size(); ++ii)
480 {
481 std::free(paramlist[ii].raw_data);
482 }
483
484 return res;
485}
486
487bool MxnetSerializer::LoadConstTensor(StaticGraph* graph, const std::vector<MxnetNode>& nodelist,
488 const std::vector<MxnetParam>& paramlist)

Callers

nothing calls this directly

Calls 9

SetGraphSourceFunction · 0.85
SetGraphSourceFormatFunction · 0.85
SetGraphConstTensorFileFunction · 0.85
SetGraphLayoutFunction · 0.85
SetModelLayoutFunction · 0.85
SetModelFormatFunction · 0.85
LoadGraphFunction · 0.85
sizeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected