| 16 | class ExprResizeComputeTest : public MNNTestCase { |
| 17 | public: |
| 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 | } |
nothing calls this directly
no test coverage detected