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

Function TEST_F

tensorflow/compiler/xla/service/bfloat16_normalization_test.cc:94–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92};
93
94TEST_F(BFloat16NormalizationTest, NoopIfSupported) {
95 auto builder = HloComputation::Builder(TestName());
96 Shape f32_shape = ShapeUtil::MakeShape(F32, {2, 4});
97 Shape bf16_shape = ShapeUtil::MakeShape(BF16, {2, 4});
98
99 HloInstruction* a = builder.AddInstruction(
100 HloInstruction::CreateParameter(0, f32_shape, "a"));
101 HloInstruction* b = builder.AddInstruction(
102 HloInstruction::CreateParameter(1, bf16_shape, "b"));
103 HloInstruction* c = builder.AddInstruction(
104 HloInstruction::CreateParameter(2, f32_shape, "c"));
105
106 HloInstruction* add0 = builder.AddInstruction(
107 HloInstruction::CreateBinary(bf16_shape, HloOpcode::kAdd, a, b));
108
109 HloInstruction* add1 = builder.AddInstruction(
110 HloInstruction::CreateBinary(f32_shape, HloOpcode::kAdd, add0, c));
111
112 auto module = CreateNewVerifiedModule();
113 auto computation = module->AddEntryComputation(builder.Build());
114
115 EXPECT_FALSE(Normalize(module.get()));
116
117 EXPECT_EQ(computation->root_instruction(), add1);
118 EXPECT_EQ(add0->shape().element_type(), BF16);
119 EXPECT_EQ(add1->shape().element_type(), F32);
120}
121
122TEST_F(BFloat16NormalizationTest, ResolveIfUnsupportedBF16) {
123 auto builder = HloComputation::Builder(TestName());

Callers

nothing calls this directly

Calls 15

TestNameFunction · 0.85
MakeShapeFunction · 0.85
MakeSortHloFunction · 0.85
AddEntryComputationMethod · 0.80
root_instructionMethod · 0.80
opcodeMethod · 0.80
num_parametersMethod · 0.80
parameter_instructionMethod · 0.80
to_applyMethod · 0.80
BuilderClass · 0.70
TF_ASSERT_OK_AND_ASSIGNFunction · 0.70

Tested by

no test coverage detected