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

Function TEST_F

tensorflow/compiler/xla/service/hlo_dce_test.cc:52–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50};
51
52TEST_F(HloDceTest, NoDeadCode) {
53 // Verify that no dead code is removed from a computation with no dead code.
54 auto builder = HloComputation::Builder(TestName());
55 auto constant1 = builder.AddInstruction(
56 HloInstruction::CreateConstant(LiteralUtil::CreateR0<float>(42.0f)));
57 auto constant2 = builder.AddInstruction(
58 HloInstruction::CreateConstant(LiteralUtil::CreateR0<float>(123.0f)));
59 builder.AddInstruction(HloInstruction::CreateBinary(
60 constant1->shape(), HloOpcode::kAdd, constant1, constant2));
61
62 auto module = CreateNewVerifiedModule();
63 auto computation = module->AddEntryComputation(builder.Build());
64
65 EXPECT_EQ(3, computation->instruction_count());
66
67 HloDCE dce;
68 EXPECT_FALSE(dce.Run(module.get()).ValueOrDie());
69
70 EXPECT_EQ(3, computation->instruction_count());
71}
72
73TEST_F(HloDceTest, InstructionsWithSideEffect) {
74 // Verify that side-effect instructions (Send in this test) are not removed.

Callers

nothing calls this directly

Calls 15

TestNameFunction · 0.85
CreateTokenFunction · 0.85
MakeShapeFunction · 0.85
AddEntryComputationMethod · 0.80
user_countMethod · 0.80
BuilderClass · 0.70
AddInstructionMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected