| 29 | typedef std::vector<std::pair<std::string, std::vector<std::string>>> OUTPUTCONFIG; |
| 30 | |
| 31 | static OUTPUTCONFIG _getAllOutputs(const MNN::Net* net, const MNN::Session* session) { |
| 32 | auto info = session->getPipelineInfo(0); |
| 33 | std::vector<std::pair<std::string, std::vector<std::string>>> res; |
| 34 | auto tensorName = net->tensorName(); |
| 35 | auto oplist = net->oplists(); |
| 36 | if (nullptr == oplist || nullptr == tensorName) { |
| 37 | FUNC_PRINT(1); |
| 38 | return res; |
| 39 | } |
| 40 | for (int i=0; i<info.second.size(); ++i) { |
| 41 | auto& unit = info.second[i]; |
| 42 | if (unit.type != MNN::Schedule::SEPARATE) { |
| 43 | continue; |
| 44 | } |
| 45 | auto op = unit.op; |
| 46 | if (op->type() == MNN::OpType_Const || op->type() == MNN::OpType_TrainableParam || op->type() == MNN::OpType_Input) { |
| 47 | continue; |
| 48 | } |
| 49 | if (nullptr == op->outputIndexes() || op->outputIndexes()->size() == 0) { |
| 50 | continue; |
| 51 | } |
| 52 | std::vector<std::string> outputNames(op->outputIndexes()->size()); |
| 53 | for (int v=0; v<op->outputIndexes()->size(); ++v) { |
| 54 | auto index = op->outputIndexes()->data()[v]; |
| 55 | outputNames[v] = tensorName->GetAsString(index)->str(); |
| 56 | } |
| 57 | res.emplace_back(std::make_pair(op->name()->str(), outputNames)); |
| 58 | } |
| 59 | return res; |
| 60 | } |
| 61 | static std::vector<std::string> _getAllInputs(const MNN::Net* net) { |
| 62 | auto tensorName = net->tensorName(); |
| 63 | auto oplist = net->oplists(); |