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

Function XLA_TEST_F

tensorflow/compiler/xla/tests/tuple_test.cc:45–61  ·  view source on GitHub ↗

Tests a tuple-shaped constant.

Source from the content-addressed store, hash-verified

43
44// Tests a tuple-shaped constant.
45XLA_TEST_F(TupleTest, TupleConstant) {
46 XlaBuilder builder(TestName());
47
48 const float constant_scalar = 7.3f;
49 std::initializer_list<float> constant_vector = {1.1f, 2.0f, 3.3f};
50 std::initializer_list<std::initializer_list<float>> constant_matrix = {
51 {1.1f, 2.2f, 3.5f}, // row 0
52 {4.8f, 5.0f, 6.7f}, // row 1
53 };
54 auto value = LiteralUtil::MakeTupleFromSlices(
55 {LiteralUtil::CreateR0<float>(constant_scalar),
56 LiteralUtil::CreateR1<float>(constant_vector),
57 LiteralUtil::CreateR2<float>(constant_matrix)});
58
59 ConstantLiteral(&builder, value);
60 ComputeAndCompareTuple(&builder, value, {}, error_spec_);
61}
62
63// Tests a tuple made of scalar constants.
64XLA_TEST_F(TupleTest, TupleScalarConstant) {

Callers

nothing calls this directly

Calls 15

TestNameFunction · 0.85
ConstantLiteralFunction · 0.85
MakeShapeFunction · 0.85
MapFunction · 0.85
DefaultFunction · 0.85
ThreadOptionsClass · 0.85
backendFunction · 0.85
ConsumeValueOrDieMethod · 0.80
ErrorSpecClass · 0.70
TupleFunction · 0.50
GetTupleElementFunction · 0.50

Tested by

no test coverage detected