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

Function TEST_F

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

Tests the reverse operation on a 4D float array on dimension 0 and 1.

Source from the content-addressed store, hash-verified

144
145// Tests the reverse operation on a 4D float array on dimension 0 and 1.
146TEST_F(ReverseTest, Reverse4DFloatArrayOnDim01) {
147 XlaBuilder b(TestName());
148 // Input shape is float[4x3x2x1].
149 // clang-format off
150 Array4D<float> input({
151 {{{1.0f}, {2.0f}},
152 {{3.0f}, {4.0f}},
153 {{5.0f}, {6.0f}}},
154 {{{7.0f}, {8.0f}},
155 {{9.0f}, {10.0f}},
156 {{11.0f}, {12.0f}}},
157 {{{13.0f}, {14.0f}},
158 {{15.0f}, {16.0f}},
159 {{17.0f}, {18.0f}}},
160 {{{19.0f}, {20.0f}},
161 {{21.0f}, {22.0f}},
162 {{23.0f}, {24.0f}}},
163 });
164 // clang-format on
165
166 Rev(ConstantR4FromArray4D<float>(&b, input), {0, 1});
167
168 // clang-format off
169 Array4D<float> expected({
170 {{{23.0f}, {24.0f}},
171 {{21.0f}, {22.0f}},
172 {{19.0f}, {20.0f}}},
173 {{{17.0f}, {18.0f}},
174 {{15.0f}, {16.0f}},
175 {{13.0f}, {14.0f}}},
176 {{{11.0f}, {12.0f}},
177 {{9.0f}, {10.0f}},
178 {{7.0f}, {8.0f}}},
179 {{{5.0f}, {6.0f}},
180 {{3.0f}, {4.0f}},
181 {{1.0f}, {2.0f}}},
182 });
183 // clang-format on
184 ComputeAndCompareR4<float>(&b, expected, {}, ErrorSpec(0.0001));
185}
186
187} // namespace
188} // namespace xla

Callers

nothing calls this directly

Calls 3

TestNameFunction · 0.85
RevFunction · 0.85
ErrorSpecClass · 0.70

Tested by

no test coverage detected