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

Function _computeTensorMask

tools/cpp/compilefornpu.cpp:66–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64 int seqLen = 0;
65};
66static void _computeTensorMask(SubModuleInfo& m, const Net* net) {
67 /**Compute All SubModule's inputs and outputs*/
68 // 0: not use, 1: input, 2: output, 3: mid, 4: valid output
69 m.tensorMask = std::vector<uint8_t>(net->tensorName()->size(), 0);
70 auto& tensorMask = m.tensorMask;
71 for (auto opIndex : m.opList) {
72 auto op = net->oplists()->GetAs<Op>(opIndex);
73 if (nullptr != op->inputIndexes()) {
74 for (int v=0; v<op->inputIndexes()->size(); ++v) {
75 auto index = op->inputIndexes()->data()[v];
76 tensorMask[index] = tensorMask[index] | 1;
77 }
78 }
79 if (nullptr != op->outputIndexes()) {
80 for (int v=0; v<op->outputIndexes()->size(); ++v) {
81 auto index = op->outputIndexes()->data()[v];
82 tensorMask[index] = tensorMask[index] | 2;
83 }
84 }
85 }
86}
87static bool _npuSupportOp(const Op* op) {
88 if (gMaxKVSize > 0) {
89 return true;

Callers 1

_createSubModuleInfoFunction · 0.70

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected