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

Function XLA_TEST_F

tensorflow/compiler/xla/tests/deconstruct_tuple_test.cc:104–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104XLA_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
130TEST_F(DeconstructTupleTest, DeconstructTupleThenDeallocate) {
131 XlaBuilder builder(TestName());

Callers

nothing calls this directly

Calls 14

TestNameFunction · 0.85
MakeShapeFunction · 0.85
ConsumeValueOrDieMethod · 0.80
TransferMethod · 0.80
TupleFunction · 0.50
TF_ASSERT_OK_AND_ASSIGNFunction · 0.50
ParameterFunction · 0.50
HasSubstrFunction · 0.50
DeconstructTupleMethod · 0.45
okMethod · 0.45
TransferToServerMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected