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

Method run

test/expr/ExecutorResetTest.cpp:89–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 }
88
89 virtual bool run(int precision) {
90 int numberThread = 0;
91 MNN::BackendConfig bnConfig;
92 auto exe = Executor::newExecutor(MNN_FORWARD_CPU, bnConfig, 1);
93 ExecutorScope scope(exe);
94 exe->setGlobalExecutorConfig(MNN_FORWARD_CPU, bnConfig, 4);
95
96 auto x = _Input({1, 3, 224, 224}, NC4HW4);
97 auto y = _ReduceSum(_Multiply(x, x), {});
98 ::memset(x->writeMap<float>(), 0, x->getInfo()->size * sizeof(float));
99 y->readMap<float>();
100 auto res = Executor::getComputeInfo(y->expr().first, MNN::Interpreter::THREAD_NUMBER, &numberThread);
101 if (numberThread != 4 || res == false) {
102 FUNC_PRINT(1);
103 return false;
104 }
105
106 exe->setGlobalExecutorConfig(MNN_FORWARD_CPU, bnConfig, 4);
107 ::memset(x->writeMap<float>(), 0, x->getInfo()->size * sizeof(float));
108 y->readMap<float>();
109 res = Executor::getComputeInfo(y->expr().first, MNN::Interpreter::THREAD_NUMBER, &numberThread);
110 if (numberThread != 4 || res == false) {
111 FUNC_PRINT(1);
112 return false;
113 }
114 exe->setGlobalExecutorConfig(MNN_FORWARD_CPU, bnConfig, 1);
115 // Reset x, y
116 x = _Input({1, 3, 224, 224}, NC4HW4);
117 y = _ReduceSum(_Multiply(x, x), {});
118 ::memset(x->writeMap<float>(), 0, x->getInfo()->size * sizeof(float));
119 y->readMap<float>();
120 res = Executor::getComputeInfo(y->expr().first, MNN::Interpreter::THREAD_NUMBER, &numberThread);
121 if (numberThread != 1 || res == false) {
122 FUNC_PRINT(1);
123 return false;
124 }
125 if (!_runmbv1()) {
126 return false;
127 }
128 return true;
129 }
130};
131MNNTestSuiteRegister(ExecutorResetTest, "expr/ExecutorReset");
132class ExecutorConfigTest : public MNNTestCase {

Callers

nothing calls this directly

Calls 5

_InputFunction · 0.85
_ReduceSumFunction · 0.85
_MultiplyFunction · 0.85
getInfoMethod · 0.45

Tested by

no test coverage detected