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

Function _computeTensorMask

express/module/PipelineModule.cpp:315–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313 bool isBreak = false;
314};
315static void _computeTensorMask(SubModuleInfo& m, const Net* net) {
316 /**Compute All SubModule's inputs and outputs*/
317 // 0: not use, 1: input, 2: output, 3: mid, 4: valid output
318 m.tensorMask = std::vector<uint8_t>(net->tensorName()->size(), 0);
319 auto& tensorMask = m.tensorMask;
320 for (auto opIndex : m.opList) {
321 auto op = net->oplists()->GetAs<Op>(opIndex);
322 if (nullptr != op->inputIndexes()) {
323 for (int v=0; v<op->inputIndexes()->size(); ++v) {
324 auto index = op->inputIndexes()->data()[v];
325 tensorMask[index] = tensorMask[index] | 1;
326 }
327 }
328 if (nullptr != op->outputIndexes()) {
329 for (int v=0; v<op->outputIndexes()->size(); ++v) {
330 auto index = op->outputIndexes()->data()[v];
331 tensorMask[index] = tensorMask[index] | 2;
332 }
333 }
334 }
335}
336
337static bool isBreakOp(const Op* op) {
338 bool isWhileControlflow = false;

Callers 1

_createSubModuleInfoFunction · 0.70

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected