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

Function CreateCaseReflect

test/expr/PaddingTest.cpp:54–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52
53template <typename T>
54bool 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
73class PaddingTest : public MNNTestCase {
74public:

Callers

nothing calls this directly

Calls 3

_ConstFunction · 0.85
_PadFunction · 0.85
getInfoMethod · 0.45

Tested by

no test coverage detected