| 52 | |
| 53 | template <typename T> |
| 54 | bool CreateCaseReflect() { |
| 55 | const T tensorData[] = {1, 2, 3, 4, 5, 6}; |
| 56 | const int padData[] = {1, 1, 2, 2}; |
| 57 | |
| 58 | const T expectedData[] = {6, 5, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 2, 1, 6, 5, 4, 5, 6, 5, 4, 3, 2, 1, 2, 3, 2, 1}; |
| 59 | |
| 60 | auto tensor = _Const(tensorData, {2, 3}, NHWC, halide_type_of<T>()); |
| 61 | auto pad = _Const(padData, {4}, NHWC, halide_type_of<int>()); |
| 62 | auto result = _Pad(tensor, pad, REFLECT); |
| 63 | |
| 64 | const auto resultData = result->template readMap<T>(); |
| 65 | const int size = result->getInfo()->size; |
| 66 | if (!checkVector<T>(resultData, expectedData, size, 0)) { |
| 67 | return false; |
| 68 | } |
| 69 | |
| 70 | return true; |
| 71 | } |
| 72 | |
| 73 | class PaddingTest : public MNNTestCase { |
| 74 | public: |