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

Method _run

test/op/SizeTest.cpp:18–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16public:
17 virtual ~SizeTest() = default;
18 bool _run(int precision, bool lazy) {
19 auto input = _Input({2, 2}, NCHW);
20 input->setName("input_tensor");
21 // set input data
22 const float inpudata[] = {-1.0, -2.0, 3.0, 4.0};
23 auto inputPtr = input->writeMap<float>();
24 memcpy(inputPtr, inpudata, 4 * sizeof(float));
25 input->unMap();
26 auto output = _Size(input);
27 const std::vector<int> expectedOutput = {4};
28 auto gotOutput = output->readMap<int>();
29 if (!checkVector<int>(gotOutput, expectedOutput.data(), 1, 0)) {
30 MNN_ERROR("SizeTest test failed!\n");
31 return false;
32 }
33 auto dims = output->getInfo()->dim;
34 if (dims.size() != 0) {
35 MNN_ERROR("SizeTest test failed!\n");
36 return false;
37 }
38 return true;
39 }
40 virtual bool run(int precision) {
41 ExecutorScope::Current()->lazyEval = false;
42 auto res = _run(precision, false);

Callers

nothing calls this directly

Calls 7

_InputFunction · 0.85
_SizeFunction · 0.85
unMapMethod · 0.80
setNameMethod · 0.45
dataMethod · 0.45
getInfoMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected