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

Method run

test/expr/ExprResizeComputeTest.cpp:18–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16class ExprResizeComputeTest : public MNNTestCase {
17public:
18 virtual bool run(int precision) {
19 {
20 auto x = _Input({2, 16, 36, 39}, NC4HW4, halide_type_of<float>());
21 auto sx = _Shape(x, true);
22 auto wh = _StridedSlice(sx, _Unsqueeze(_Scalar<int32_t>(2), {0}), _Unsqueeze(_Scalar<int32_t>(4), {0}),
23 _Unsqueeze(_Scalar<int32_t>(1), {0}), 0, 0, 0, 0, 0);
24 wh = wh * _Scalar<int32_t>(2);
25 auto y = _Interp({x, wh}, 0.0f, 0.0f, 0, 0, 1, true);
26 auto yShape = y->getInfo();
27 if (yShape->dim[2] != 72 || yShape->dim[3] != 78) {
28 return false;
29 }
30 {
31 auto ptr = y->readMap<float>();
32 if (nullptr != ptr) {
33 FUNC_PRINT(1);
34 return false;
35 }
36 }
37 {
38 x->writeMap<float>();
39 auto ptr = y->readMap<float>();
40 if (nullptr == ptr) {
41 return false;
42 }
43 }
44 x->resize({1, 16, 44, 45});
45 yShape = y->getInfo();
46 if (yShape->dim[2] != 88 || yShape->dim[3] != 90) {
47 return false;
48 }
49 {
50 x->writeMap<float>();
51 auto ptr = y->readMap<float>();
52 if (nullptr == ptr) {
53 return false;
54 }
55 }
56 }
57 {
58 auto x = _Input({2, 16, 36, 39}, NC4HW4, halide_type_of<float>());
59 auto whi = _Input({2}, NHWC, halide_type_of<int32_t>());
60 auto whPtr = whi->writeMap<int32_t>();
61 whPtr[0] = 66;
62 whPtr[1] = 77;
63 auto wh = whi * _Scalar<int32_t>(2);
64 auto y = _Interp({x, wh}, 0.0f, 0.0f, 0, 0, 1, true);
65 auto yShape = y->getInfo();
66 if (yShape->dim[2] != 66 * 2 || yShape->dim[3] != 77 * 2) {
67 return false;
68 }
69 {
70 x->writeMap<float>();
71 auto ptr = y->readMap<float>();
72 if (nullptr == ptr) {
73 return false;
74 }
75 }

Callers

nothing calls this directly

Calls 12

_InputFunction · 0.85
_ShapeFunction · 0.85
_StridedSliceFunction · 0.85
_UnsqueezeFunction · 0.85
_InterpFunction · 0.85
unMapMethod · 0.80
createFunction · 0.50
getInfoMethod · 0.45
resizeMethod · 0.45
releaseMethod · 0.45
getMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected