| 72 | return "Unknown"; |
| 73 | } |
| 74 | int main(int argc, char *argv[]) { |
| 75 | if (argc < 2) { |
| 76 | MNN_ERROR("Usage: ./GetMNNInfo ${test.mnn}\n"); |
| 77 | return 0; |
| 78 | } |
| 79 | std::string modelName = argv[1]; |
| 80 | std::vector<std::string> empty; |
| 81 | std::shared_ptr<Module> net(Module::load(empty, empty, argv[1])); |
| 82 | if (nullptr == net.get()) { |
| 83 | MNN_ERROR("Load MNN from %s Failed\n", argv[1]); |
| 84 | return 1; |
| 85 | } |
| 86 | auto info = net->getInfo(); |
| 87 | MNN_ASSERT(info->inputNames.size() == info->inputs.size()); |
| 88 | MNN_PRINT("Model default dimensionFormat is %s\n", _getFormatString(info->defaultFormat).c_str()); |
| 89 | MNN_PRINT("Model Inputs:\n"); |
| 90 | for (int i=0; i<info->inputNames.size(); ++i) { |
| 91 | auto& varInfo = info->inputs[i]; |
| 92 | MNN_PRINT("[ %s ]: dimensionFormat: %s, ", info->inputNames[i].c_str(), _getFormatString(varInfo.order).c_str()); |
| 93 | MNN_PRINT("size: [ "); |
| 94 | if (varInfo.dim.size() > 0) { |
| 95 | for (int j=0; j<(int)varInfo.dim.size() - 1; ++j) { |
| 96 | MNN_PRINT("%d,", varInfo.dim[j]); |
| 97 | } |
| 98 | MNN_PRINT("%d ", varInfo.dim[(int)varInfo.dim.size() - 1]); |
| 99 | } |
| 100 | MNN_PRINT("], "); |
| 101 | MNN_PRINT("type is %s\n", _getDataType(varInfo.type).c_str()); |
| 102 | } |
| 103 | MNN_PRINT("Model Outputs:\n"); |
| 104 | for (int i=0; i<info->outputNames.size(); ++i) { |
| 105 | MNN_PRINT("[ %s ]\n", info->outputNames[i].c_str()); |
| 106 | } |
| 107 | if (info->version.empty()) { |
| 108 | MNN_PRINT("Model Version: < 2.0.0\n"); |
| 109 | } else { |
| 110 | MNN_PRINT("Model Version: %s \n", info->version.c_str()); |
| 111 | } |
| 112 | if (!info->bizCode.empty()) { |
| 113 | MNN_PRINT("Model bizCode: %s\n", info->bizCode.c_str()); |
| 114 | } |
| 115 | if (!info->metaData.empty()) { |
| 116 | MNN_PRINT("MetaData: Begin \n"); |
| 117 | for (auto& iter : info->metaData) { |
| 118 | MNN_PRINT("[Meta] %s : %s\n", iter.first.c_str(), iter.second.c_str()); |
| 119 | } |
| 120 | MNN_PRINT("MetaData: End \n"); |
| 121 | } |
| 122 | MNN_PRINT("Get Op info to op.txt\n"); |
| 123 | std::set<std::string> originTypes; |
| 124 | { |
| 125 | MNN_PRINT("Appen op lists to op.txt\n"); |
| 126 | std::ifstream is("op.txt"); |
| 127 | if (!is.fail()) { |
| 128 | std::string tmp; |
| 129 | while (std::getline(is, tmp, '\n')) { |
| 130 | originTypes.insert(tmp); |
| 131 | } |
nothing calls this directly
no test coverage detected