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

Method prepareCompute

express/Expr.cpp:890–910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

888 }
889}
890void Variable::prepareCompute(const std::vector<VARP>& vars, bool forceCpu) {
891 std::vector<EXPRP> exprs;
892 for (auto v : vars) {
893 if (nullptr != v && nullptr != v->mFrom->get()) {
894 if (!v->expr().first->visited() && nullptr == v->expr().first->inside()->mCache) {
895 v->expr().first->requireInfo();
896 v->expr().first->setVisited(true);
897 exprs.emplace_back(v->expr().first);
898 }
899 }
900 }
901 for (auto v : vars) {
902 if (nullptr != v && nullptr != v->mFrom->get()) {
903 v->expr().first->setVisited(false);
904 }
905 }
906 if (exprs.empty()) {
907 return;
908 }
909 ExecutorScope::Current()->makeCache(std::move(exprs), forceCpu);
910}
911
912void Variable::compute(const std::vector<VARP>& vars, bool forceCPU) {
913 prepareCompute(vars, forceCPU);

Callers

nothing calls this directly

Calls 6

requireInfoMethod · 0.80
setVisitedMethod · 0.80
getMethod · 0.45
visitedMethod · 0.45
emptyMethod · 0.45
makeCacheMethod · 0.45

Tested by

no test coverage detected