| 18 | class MMapTest : public MNNTestCase { |
| 19 | public: |
| 20 | virtual bool run(int precision) { |
| 21 | if (MNN_FORWARD_CPU != getCurrentType()) { |
| 22 | MNN_ERROR("Currently don't test not cpu mmap\n"); |
| 23 | return true; |
| 24 | } |
| 25 | auto executor = cloneCurrentExecutor(); |
| 26 | ExecutorScope scope(executor); |
| 27 | auto x = _Input({1, 3, 224, 224}, NC4HW4, halide_type_of<float>()); |
| 28 | x->setName("x"); |
| 29 | auto y = _Conv(1.0f, 0.01f, x, {3, 16}, {5, 5}); |
| 30 | y->setName("y"); |
| 31 | auto buffer = MNN::Express::Variable::save({y}); |
| 32 | ScheduleConfig config; |
| 33 | config.type = getCurrentType(); |
| 34 | std::shared_ptr<Executor::RuntimeManager> rtm( Executor::RuntimeManager::createRuntimeManager(config)); |
| 35 | rtm->setExternalPath("tmp", MNN::Interpreter::EXTERNAL_WEIGHT_DIR); |
| 36 | Module::Config mconfig; |
| 37 | mconfig.rearrange = true; |
| 38 | std::shared_ptr<MNN::Express::Module> m(Module::load({"x"}, {"y"}, (const unsigned char*)buffer.data(), buffer.size(), rtm, &mconfig), Module::destroy); |
| 39 | |
| 40 | // forward_type, precision_type, memory_type, power_type |
| 41 | auto pStatus = MNNTestSuite::get()->pStaus; |
| 42 | // The same as CPUBackend |
| 43 | std::string prefix = "0_0_0_0_"; |
| 44 | prefix[2] += pStatus.precision; |
| 45 | prefix[4] += pStatus.memory; |
| 46 | prefix[6] += pStatus.power; |
| 47 | std::string fileName = MNNFilePathConcat("tmp", prefix + "0.static"); |
| 48 | if (!MNNFileExist(fileName.c_str())) { |
| 49 | FUNC_PRINT(1); |
| 50 | return false; |
| 51 | } |
| 52 | m.reset(); |
| 53 | if (MNNFileExist(fileName.c_str())) { |
| 54 | FUNC_PRINT(1); |
| 55 | return false; |
| 56 | } |
| 57 | return true; |
| 58 | } |
| 59 | }; |
| 60 | MNNTestSuiteRegister(MMapTest, "expr/mmaptest"); |
nothing calls this directly
no test coverage detected