Tests the reverse operation on a 4D U8 array on dimension 0 and 3.
| 114 | |
| 115 | // Tests the reverse operation on a 4D U8 array on dimension 0 and 3. |
| 116 | XLA_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. |
| 146 | TEST_F(ReverseTest, Reverse4DFloatArrayOnDim01) { |