MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / XLA_TEST_F

Function XLA_TEST_F

tensorflow/compiler/xla/tests/reverse_test.cc:116–143  ·  view source on GitHub ↗

Tests the reverse operation on a 4D U8 array on dimension 0 and 3.

Source from the content-addressed store, hash-verified

114
115// Tests the reverse operation on a 4D U8 array on dimension 0 and 3.
116XLA_TEST_F(ReverseTest, Reverse4DU8ArrayOnDim23) {
117 XlaBuilder b(TestName());
118 // Input shape is U8[1x2x3x4].
119 // clang-format off
120 Array4D<uint8> input({{
121 {{1, 2, 3, 4},
122 {5, 6, 7, 8},
123 {9, 10, 11, 12}},
124 {{13, 14, 15, 16},
125 {17, 18, 19, 20},
126 {21, 22, 23, 24}},
127 }});
128 // clang-format on
129
130 Rev(ConstantR4FromArray4D<uint8>(&b, input), {0, 3});
131
132 // clang-format off
133 Array4D<uint8> expected({{
134 {{4, 3, 2, 1},
135 {8, 7, 6, 5},
136 {12, 11, 10, 9}},
137 {{16, 15, 14, 13},
138 {20, 19, 18, 17},
139 {24, 23, 22, 21}},
140 }});
141 // clang-format on
142 ComputeAndCompareR4<uint8>(&b, expected, {});
143}
144
145// Tests the reverse operation on a 4D float array on dimension 0 and 1.
146TEST_F(ReverseTest, Reverse4DFloatArrayOnDim01) {

Callers

nothing calls this directly

Calls 2

TestNameFunction · 0.85
RevFunction · 0.85

Tested by

no test coverage detected