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

Function TEST_F

tensorflow/compiler/xla/tools/hlo_extractor_test.cc:28–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26using HloExtractorTest = HloTestBase;
27
28TEST_F(HloExtractorTest, ExtractTopLevel) {
29 const string& hlo_string = R"(
30HloModule test
31
32ENTRY %entry {
33 param.0 = f32[4]{0} parameter(0)
34 negate = f32[4]{0} negate(f32[4]{0} param.0)
35 ROOT exp = f32[4]{0} exponential(f32[4]{0} negate)
36}
37)";
38
39 TF_ASSERT_OK_AND_ASSIGN(std::unique_ptr<HloModule> hlo_module,
40 ParseAndReturnVerifiedModule(hlo_string));
41
42 {
43 auto extracted_module =
44 ExtractModule(FindInstruction(hlo_module.get(), "exp"));
45 EXPECT_THAT(extracted_module->entry_computation()->root_instruction(),
46 op::Exp(op::Negate(op::Parameter(0))));
47 }
48
49 {
50 auto extracted_module =
51 ExtractModule(FindInstruction(hlo_module.get(), "exp"), /*height=*/0);
52 EXPECT_THAT(extracted_module->entry_computation()->root_instruction(),
53 op::Exp(op::Parameter(0)));
54 }
55
56 {
57 auto extracted_module = ExtractModule(
58 FindInstruction(hlo_module.get(), "negate"), /*height=*/0);
59 EXPECT_THAT(extracted_module->entry_computation()->root_instruction(),
60 op::Negate(op::Parameter(0)));
61 }
62}
63
64TEST_F(HloExtractorTest, ExtractDag) {
65 const string& hlo_string = R"(

Callers

nothing calls this directly

Calls 12

ExtractModuleFunction · 0.85
FindInstructionFunction · 0.85
NegateFunction · 0.85
root_instructionMethod · 0.80
entry_computationMethod · 0.80
TF_ASSERT_OK_AND_ASSIGNFunction · 0.50
ExpClass · 0.50
ParameterFunction · 0.50
TanhClass · 0.50
AddClass · 0.50
ConstantFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected