| 84 | } |
| 85 | |
| 86 | const RuntimeCreator* MNNGetExtraRuntimeCreator(MNNForwardType type) { |
| 87 | registerBackend(); |
| 88 | |
| 89 | auto& gExtraCreator = GetExtraCreator(); |
| 90 | auto iter = gExtraCreator.find(type); |
| 91 | if (iter == gExtraCreator.end()) { |
| 92 | return nullptr; |
| 93 | } |
| 94 | if (!iter->second.second) { |
| 95 | return iter->second.first; |
| 96 | } |
| 97 | Backend::Info info; |
| 98 | info.type = type; |
| 99 | std::shared_ptr<Runtime> bn(iter->second.first->onCreate(info)); |
| 100 | if (nullptr != bn.get()) { |
| 101 | return iter->second.first; |
| 102 | } |
| 103 | return nullptr; |
| 104 | } |
| 105 | |
| 106 | bool MNNInsertExtraRuntimeCreator(MNNForwardType type, const RuntimeCreator* creator, bool needCheck) { |
| 107 | auto& gExtraCreator = GetExtraCreator(); |