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

Function TEST_F

tensorflow/compiler/xla/tests/replay_test.cc:39–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37class ReplayTest : public ClientLibraryTestBase {};
38
39TEST_F(ReplayTest, TwoPlusTwoReplay) {
40 // Make 2+2 computation.
41 XlaBuilder builder(TestName());
42 auto two = ConstantR0<int32>(&builder, 2);
43 Add(two, two);
44 XlaComputation computation = builder.Build().ConsumeValueOrDie();
45
46 // Serialize it out.
47 std::unique_ptr<HloSnapshot> module =
48 computation.Snapshot().ConsumeValueOrDie();
49
50 // Replay it.
51 XlaComputation replayed = client_->LoadSnapshot(*module).ConsumeValueOrDie();
52
53 // Check signature is the same.
54 std::unique_ptr<ProgramShape> original_shape =
55 client_->GetComputationShape(computation).ConsumeValueOrDie();
56 std::unique_ptr<ProgramShape> replayed_shape =
57 client_->GetComputationShape(replayed).ConsumeValueOrDie();
58 ASSERT_TRUE(protobuf_util::ProtobufEquals(original_shape->ToProto(),
59 replayed_shape->ToProto()));
60
61 // Run it.
62 Literal literal =
63 client_
64 ->ExecuteAndTransfer(replayed, /*arguments=*/{}, &execution_options_)
65 .ConsumeValueOrDie();
66
67 // Expect 4.
68 LiteralTestUtil::ExpectR0Equal<int32>(4, literal);
69}
70
71XLA_TEST_F(ReplayTest, XPlusYReplayWithParameters) {
72 // Make computation.

Callers

nothing calls this directly

Calls 13

TestNameFunction · 0.85
ProtobufEqualsFunction · 0.85
MakeShapeFunction · 0.85
MapFunction · 0.85
ConsumeValueOrDieMethod · 0.80
LoadSnapshotMethod · 0.80
GetComputationShapeMethod · 0.80
AddClass · 0.50
ParameterFunction · 0.50
BuildMethod · 0.45
SnapshotMethod · 0.45
ToProtoMethod · 0.45

Tested by

no test coverage detected