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

Function _splitSubModuleForShapeConst

express/module/PipelineModule.cpp:460–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458 return res;
459}
460static std::vector<SubModuleInfo> _splitSubModuleForShapeConst(const std::vector<SubModuleInfo>& origin, const Net* net, std::shared_ptr<Schedule::ScheduleInfo> sharedConst) {
461 std::vector<SubModuleInfo> res;
462 for (auto& m : origin) {
463 if (m.isBreak) {
464 res.emplace_back(std::move(m));
465 continue;
466 }
467 auto breakIndexes = _findBreakIndex(m, net, sharedConst);
468 if (breakIndexes.size() > 0) {
469 int current = 0;
470 for (auto breakIndex : breakIndexes) {
471 // Split
472 if (breakIndex > current) {
473 SubModuleInfo m0;
474 m0.opList.insert(m0.opList.begin(), m.opList.begin() + current, m.opList.begin() + breakIndex);
475 res.emplace_back(std::move(m0));
476 }
477 SubModuleInfo m1;
478 m1.opList = {m.opList[breakIndex]};
479 res.emplace_back(std::move(m1));
480 current = breakIndex + 1;
481 }
482 if (current < m.opList.size()) {
483 SubModuleInfo m2;
484 m2.opList.insert(m2.opList.begin(), m.opList.begin() + current, m.opList.end());
485 res.emplace_back(std::move(m2));
486 }
487 } else {
488 res.emplace_back(std::move(m));
489 }
490 }
491 return res;
492}
493
494static std::vector<SubModuleInfo> _createSubModuleInfo(std::shared_ptr<BufferStorage> bufferStorage, const std::set<int>& inputIndexes, const std::set<int>& outputIndexes, const std::set<int>& noComputeIndexes, std::shared_ptr<Schedule::ScheduleInfo> sharedConst, bool& success) {
495 std::vector<SubModuleInfo> submodule;

Callers 1

_createSubModuleInfoFunction · 0.70

Calls 5

_findBreakIndexFunction · 0.70
sizeMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected