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

Function _getAllOutputs

tools/cpp/backendTest.cpp:31–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29typedef std::vector<std::pair<std::string, std::vector<std::string>>> OUTPUTCONFIG;
30
31static 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}
61static std::vector<std::string> _getAllInputs(const MNN::Net* net) {
62 auto tensorName = net->tensorName();
63 auto oplist = net->oplists();

Callers 1

mainFunction · 0.85

Calls 6

GetAsStringMethod · 0.80
sizeMethod · 0.45
typeMethod · 0.45
dataMethod · 0.45
strMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected