| 102 | } |
| 103 | |
| 104 | XLA_TEST_F(DeconstructTupleTest, DeconstructTupleRepeatedElement) { |
| 105 | XlaBuilder builder(TestName()); |
| 106 | auto const1 = ConstantR1<float>(&builder, {1.0, 2.0, 3.0, 4.0}); |
| 107 | auto const2 = ConstantR1<float>(&builder, {2.0, 4.0, 6.0, 8.0}); |
| 108 | Tuple(&builder, {const1, const2, const2, const1}); |
| 109 | auto global_data = ExecuteAndCheckTransfer(&builder, {}); |
| 110 | |
| 111 | auto result_status = client_->DeconstructTuple(*global_data); |
| 112 | EXPECT_TRUE(result_status.ok()); |
| 113 | |
| 114 | // Verify the returned GlobalDataHandle arrays have repeated elements like the |
| 115 | // tuple does. That is, in the returned vector of handles, handle[0] should be |
| 116 | // the same as handle[3] and handle[1] should be the same as handle[2]. |
| 117 | auto handles = result_status.ConsumeValueOrDie(); |
| 118 | |
| 119 | Literal literal; |
| 120 | TF_ASSERT_OK_AND_ASSIGN(literal, client_->Transfer(*handles[0])); |
| 121 | LiteralTestUtil::ExpectR1Equal<float>({1.0, 2.0, 3.0, 4.0}, literal); |
| 122 | TF_ASSERT_OK_AND_ASSIGN(literal, client_->Transfer(*handles[1])); |
| 123 | LiteralTestUtil::ExpectR1Equal<float>({2.0, 4.0, 6.0, 8.0}, literal); |
| 124 | TF_ASSERT_OK_AND_ASSIGN(literal, client_->Transfer(*handles[2])); |
| 125 | LiteralTestUtil::ExpectR1Equal<float>({2.0, 4.0, 6.0, 8.0}, literal); |
| 126 | TF_ASSERT_OK_AND_ASSIGN(literal, client_->Transfer(*handles[3])); |
| 127 | LiteralTestUtil::ExpectR1Equal<float>({1.0, 2.0, 3.0, 4.0}, literal); |
| 128 | } |
| 129 | |
| 130 | TEST_F(DeconstructTupleTest, DeconstructTupleThenDeallocate) { |
| 131 | XlaBuilder builder(TestName()); |
nothing calls this directly
no test coverage detected