| 1457 | class ExecutorResetLoadModuleTest : public MNNTestCase { |
| 1458 | public: |
| 1459 | virtual bool run(int precision) { |
| 1460 | BackendConfig originConfig; |
| 1461 | auto exe = Executor::newExecutor(MNN_FORWARD_CPU, originConfig, 1); |
| 1462 | ExecutorScope _s(exe); |
| 1463 | // Make Model include convolution in shape compute and content compute |
| 1464 | auto x = _Input({1, 3, 24, 24}, NCHW, halide_type_of<float>()); |
| 1465 | x->setName("x"); |
| 1466 | auto xs = _Convert(_Reshape(_Cast<float>(_Shape(x, NCHW)), {1, 1, 2, 2}), NC4HW4); |
| 1467 | xs = _Convert(_Conv(1.0f, 0.0f, xs, {1, 1}, {2, 2}), NCHW); |
| 1468 | auto y = _Conv(0.1f, 0.0f, _Convert(x, NC4HW4), {3, 1}, {3, 3}); |
| 1469 | y = _Convert(y, NCHW); |
| 1470 | y = _ReduceMean(y); |
| 1471 | y = y * _Reciprocal(xs); |
| 1472 | auto info = y->getInfo(); |
| 1473 | y->setName("y"); |
| 1474 | auto buffer = Variable::save({y}); |
| 1475 | MNN::ScheduleConfig sconfig; |
| 1476 | BackendConfig bnConfig; |
| 1477 | bnConfig.precision = MNN::BackendConfig::Precision_Low; |
| 1478 | bnConfig.memory = MNN::BackendConfig::Memory_Low; |
| 1479 | sconfig.backendConfig = &bnConfig; |
| 1480 | sconfig.numThread = 4; |
| 1481 | exe->setGlobalExecutorConfig(MNN_FORWARD_CPU, bnConfig, 4); |
| 1482 | std::shared_ptr<Executor::RuntimeManager> rtMgr(Executor::RuntimeManager::createRuntimeManager(sconfig)); |
| 1483 | Module::Config config; |
| 1484 | config.rearrange = false; |
| 1485 | std::shared_ptr<MNN::Express::Module> m0(Module::load({"x"}, {"y"}, (const unsigned char*)buffer.data(), buffer.size(), nullptr, &config), Module::destroy); |
| 1486 | config.rearrange = true; |
| 1487 | std::shared_ptr<MNN::Express::Module> m1(Module::load({"x"}, {"y"}, (const unsigned char*)buffer.data(), buffer.size(), rtMgr, &config), Module::destroy); |
| 1488 | auto m0Rt = m0->getInfo()->runTimeManager; |
| 1489 | auto m1Rt = m1->getInfo()->runTimeManager; |
| 1490 | if (nullptr == m0Rt->getBnConfig() || nullptr == m1Rt->getBnConfig()) { |
| 1491 | FUNC_PRINT(1); |
| 1492 | return false; |
| 1493 | } |
| 1494 | if (MNN::BackendConfig::Precision_Low != m0Rt->getBnConfig()->precision || MNN::BackendConfig::Memory_Low != m0Rt->getBnConfig()->memory) { |
| 1495 | FUNC_PRINT(1); |
| 1496 | return false; |
| 1497 | } |
| 1498 | if (MNN::BackendConfig::Precision_Low != m1Rt->getBnConfig()->precision || MNN::BackendConfig::Memory_Low != m1Rt->getBnConfig()->memory) { |
| 1499 | FUNC_PRINT(1); |
| 1500 | return false; |
| 1501 | } |
| 1502 | return true; |
| 1503 | } |
| 1504 | }; |
| 1505 | MNNTestSuiteRegister(ExecutorResetLoadModuleTest, "expr/ExecutorResetLoadModuleTest"); |
| 1506 |
nothing calls this directly
no test coverage detected