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

Method run

test/expr/RasterOutputTest.cpp:37–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35class RasterOutputTest : public MNNTestCase {
36public:
37 virtual bool run(int precision) {
38 auto executor = cloneCurrentExecutor();
39 ExecutorScope scope(executor);
40 auto net = _createModel();
41 auto x = _Input({1, 3, 224, 224}, NCHW, halide_type_of<int>());
42 auto y = _Transpose(x, {0, 1, 3, 2});
43 auto z = _Add(y, _Scalar<int>(1));
44 auto q = _Negative(y);
45 auto p = _Transpose(q, {0, 3, 1, 2});
46 {
47 auto xPtr = x->writeMap<int>();
48 for (int v = 0; v < 1 * 3 * 224 * 224; ++ v) {
49 xPtr[v] = v;
50 }
51 x->unMap();
52 }
53 auto outputs = net->onForward({x});
54 {
55 auto dPtr = outputs[0]->readMap<int>();
56 auto zPtr = z->readMap<int>();
57 auto size = z->getInfo()->size;
58 for (int v = 0; v < size; ++v) {
59 if (zPtr[v] != dPtr[v]) {
60 return false;
61 }
62 }
63 }
64 {
65 auto dPtr = outputs[1]->readMap<int>();
66 auto zPtr = p->readMap<int>();
67 auto size = p->getInfo()->size;
68 for (int v = 0; v < size; ++v) {
69 if (zPtr[v] != dPtr[v]) {
70 return false;
71 }
72 }
73 }
74 return true;
75 }
76};
77MNNTestSuiteRegister(RasterOutputTest, "expr/RasterOutput");

Callers

nothing calls this directly

Calls 9

cloneCurrentExecutorFunction · 0.85
_InputFunction · 0.85
_TransposeFunction · 0.85
_AddFunction · 0.85
_NegativeFunction · 0.85
unMapMethod · 0.80
_createModelFunction · 0.70
onForwardMethod · 0.45
getInfoMethod · 0.45

Tested by

no test coverage detected