MCPcopy Create free account
hub / github.com/alibaba/MNN / getConvertMap

Method getConvertMap

tools/converter/source/optimizer/PostTreatUtils.cpp:19–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17 return std::find(vec.begin(), vec.end(), val) != vec.end();
18}
19std::map<std::string, std::shared_ptr<PostConverter>>* PostConverter::getConvertMap() {
20 static std::once_flag of;
21 static std::map<std::string, std::shared_ptr<PostConverter>>* gConverter;
22 std::call_once(of, [&]() {
23 gConverter = new std::map<std::string, std::shared_ptr<PostConverter>>;
24 auto count = MNN::OpCount::get();
25 count->insertOp("TF", "Dropout");
26 count->insertOp("TF", "NoOp");
27 count->insertOp("TF", "Print");
28 count->insertOp("CAFFE", "Dropout");
29 count->insertOp("CAFFE", "Split");
30 auto unuseExtraOpType = std::vector<std::string>({"Identity", "IdentityN", "NoOp", "Assign", "Print", "Assert", "StopGradient", "Enter", "NextIteration"});
31 for (auto& s : unuseExtraOpType) {
32 count->insertOp("TF", s);
33 }
34 std::set<std::string> controlOps{"Merge", "Switch", "LoopCond", "Enter", "Exit", "NextIteration"};
35 for (auto& s : controlOps) {
36 count->insertOp("TF", s);
37 }
38 count->insertOp("ONNX", "Identity");
39 });
40 return gConverter;
41}
42PostConverter* PostConverter::get(std::string key) {
43 auto gConverter = getConvertMap();
44 if (gConverter->find(key) != gConverter->end()) {

Callers

nothing calls this directly

Calls 3

call_onceFunction · 0.85
insertOpMethod · 0.80
getFunction · 0.50

Tested by

no test coverage detected