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

Function CreateCaseSymmetric

test/expr/PaddingTest.cpp:34–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33template <typename T>
34bool CreateCaseSymmetric() {
35 const T tensorData[] = {1, 2, 3, 4, 5, 6};
36 const int padData[] = {1, 1, 2, 2};
37
38 const T expectedData[] = {2, 1, 1, 2, 3, 3, 2, 2, 1, 1, 2, 3, 3, 2, 5, 4, 4, 5, 6, 6, 5, 5, 4, 4, 5, 6, 6, 5};
39
40 auto tensor = _Const(tensorData, {2, 3}, NHWC, halide_type_of<T>());
41 auto pad = _Const(padData, {4}, NHWC, halide_type_of<int>());
42 auto result = _Pad(tensor, pad, SYMMETRIC);
43
44 const auto resultData = result->template readMap<T>();
45 const int size = result->getInfo()->size;
46 if (!checkVector<T>(resultData, expectedData, size, 0)) {
47 return false;
48 }
49
50 return true;
51}
52
53template <typename T>
54bool CreateCaseReflect() {

Callers

nothing calls this directly

Calls 3

_ConstFunction · 0.85
_PadFunction · 0.85
getInfoMethod · 0.45

Tested by

no test coverage detected