| 66 | } |
| 67 | |
| 68 | virtual bool run(int precision) { |
| 69 | auto net = MNN::Interpreter::createFromFile(this->model().c_str()); |
| 70 | if (NULL == net) { |
| 71 | return false; |
| 72 | } |
| 73 | ScheduleConfig cpuconfig; |
| 74 | cpuconfig.type = MNN_FORWARD_CPU; |
| 75 | auto CPU = net->createSession(cpuconfig); |
| 76 | auto input = tensorFromFile(net->getSessionInput(CPU, NULL), this->input()); |
| 77 | auto expect = tensorFromFile(net->getSessionOutput(CPU, NULL), this->expect()); |
| 78 | |
| 79 | dispatch([&](MNNForwardType backend) -> void { |
| 80 | ScheduleConfig config; |
| 81 | config.type = backend; |
| 82 | auto session = net->createSession(config); |
| 83 | net->getSessionInput(session, NULL)->copyFromHostTensor(input.get()); |
| 84 | net->runSession(session); |
| 85 | auto output = net->getSessionOutput(session, NULL); |
| 86 | float tolerance = backend == MNN_FORWARD_CPU ? 0.01 : 0.1; |
| 87 | assert(TensorUtils::compareTensors(output, expect.get(), tolerance, true)); |
| 88 | }); |
| 89 | delete net; |
| 90 | return true; |
| 91 | } |
| 92 | }; |
| 93 | |
| 94 | class SqueezeNetV1_0Test : public SqueezeNetTest { |
nothing calls this directly
no test coverage detected