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

Function TEST_F

tensorflow/compiler/xla/tests/broadcast_test.cc:151–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151TEST_F(BroadcastTest, Broadcast_R1_2_To_R4_2x2x3x3) {
152 auto builder = HloComputation::Builder(TestName());
153 auto input = builder.AddInstruction(
154 HloInstruction::CreateConstant(LiteralUtil::CreateR1<float>({1.0, 2.0})));
155
156 // Broadcast vector in dimension 1.
157 builder.AddInstruction(HloInstruction::CreateBroadcast(
158 ShapeUtil::MakeShape(F32, {2, 2, 3, 3}), input, {1}));
159
160 // Create HLO module, compile, and execute.
161 auto hlo_module = CreateNewVerifiedModule();
162 hlo_module->AddEntryComputation(builder.Build());
163 auto result = ExecuteAndTransfer(std::move(hlo_module), {});
164
165 Array4D<float> expected(2, 2, 3, 3);
166 Array2D<float> pz({{1, 2}, {1, 2}});
167 expected.FillWithPZ(pz);
168
169 EXPECT_TRUE(LiteralTestUtil::Near(
170 LiteralUtil::CreateR4FromArray4D<float>(expected), result, error_spec_));
171}
172
173TEST_F(BroadcastTest, Broadcast_R1_1025_To_R4_3x3x3x1025) {
174 auto builder = HloComputation::Builder(TestName());

Callers

nothing calls this directly

Calls 15

TestNameFunction · 0.85
MakeShapeFunction · 0.85
NearFunction · 0.85
AddEntryComputationMethod · 0.80
FillWithPZMethod · 0.80
FillWithYXMethod · 0.80
BuilderClass · 0.50
AddInstructionMethod · 0.45
BuildMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected