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

Method LoadGraph

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

Source from the content-addressed store, hash-verified

634}
635
636bool MxnetSerializer::LoadGraph(StaticGraph* graph, const std::vector<MxnetNode>& nodelist,
637 const std::vector<MxnetParam>& paramlist)
638{
639 SetGraphIdentity(graph, "mxnet", graph->model_name, "0");
640
641 LoadConstTensor(graph, nodelist, paramlist);
642 CreateInputNode(graph, nodelist, paramlist);
643
644 unsigned int i;
645 std::vector<std::string> no_supported_op;
646 for(i = 0; i < nodelist.size(); i++)
647 {
648 MxnetNode mxnet_node = nodelist.at(i);
649 if(mxnet_node.op == "null" || mxnet_node.op == "_zeros")
650 continue;
651 if(!FindOpLoadMethod(mxnet_node.op))
652 {
653 auto it = find(no_supported_op.begin(),no_supported_op.end(),mxnet_node.op);
654 if(it != no_supported_op.end())
655 no_supported_op.push_back(mxnet_node.op);
656 }
657 }
658 if(no_supported_op.size())
659 {
660 LOG_ERROR() << "These" <<no_supported_op.size() <<"ops are not supported \n";
661 LOG_ERROR() << "{";
662 for(int j = 0; j < (int)no_supported_op.size(); j++)
663 {
664 LOG_ERROR() << no_supported_op[j] <<",";
665 }
666 LOG_ERROR() << "}\n";
667 return false;
668 }
669
670 for(i = 0; i < nodelist.size(); i++)
671 {
672 MxnetNode mxnet_node = nodelist.at(i);
673
674 if(mxnet_node.op == "null" || mxnet_node.op == "_zeros")
675 continue;
676
677 // if(!FindOpLoadMethod(mxnet_node.op))
678 // {
679 // LOG_ERROR() << "Cannot find load function for operator: " << mxnet_node.op << "\n";
680 // break;
681 // }
682
683 StaticNode* node = CreateStaticNode(graph, mxnet_node.name);
684
685 LoadNode(graph, node, mxnet_node, nodelist);
686
687 op_load_t op_func = any_cast<op_load_t>(GetOpLoadMethod(mxnet_node.op));
688
689 if(!op_func(graph, node, mxnet_node))
690 break;
691 }
692
693 if(i < nodelist.size())

Callers

nothing calls this directly

Calls 8

SetGraphIdentityFunction · 0.85
LoadConstTensorFunction · 0.85
CreateInputNodeFunction · 0.85
FindOpLoadMethodFunction · 0.85
CreateStaticNodeFunction · 0.85
beginMethod · 0.80
endMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected