| 17 | return std::find(vec.begin(), vec.end(), val) != vec.end(); |
| 18 | } |
| 19 | std::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 | } |
| 42 | PostConverter* PostConverter::get(std::string key) { |
| 43 | auto gConverter = getConvertMap(); |
| 44 | if (gConverter->find(key) != gConverter->end()) { |