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

Method run

test/model/SqueezeNetTest.cpp:68–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
94class SqueezeNetV1_0Test : public SqueezeNetTest {

Callers

nothing calls this directly

Calls 12

inputMethod · 0.95
dispatchFunction · 0.85
assertFunction · 0.85
getSessionInputMethod · 0.80
getSessionOutputMethod · 0.80
copyFromHostTensorMethod · 0.80
runSessionMethod · 0.80
c_strMethod · 0.45
modelMethod · 0.45
createSessionMethod · 0.45
expectMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected