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

Function XLA_TEST_F

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

Source from the content-addressed store, hash-verified

34class BroadcastTest : public HloTestBase {};
35
36XLA_TEST_F(BroadcastTest, BroadcastScalarToScalar) {
37 // Test degenerate case of broadcasting a scalar into a scalar.
38 auto builder = HloComputation::Builder(TestName());
39 auto input = builder.AddInstruction(
40 HloInstruction::CreateConstant(LiteralUtil::CreateR0<float>(42.0)));
41 builder.AddInstruction(HloInstruction::CreateBroadcast(
42 ShapeUtil::MakeShape(F32, {}), input, {}));
43
44 // Create HLO module, compile, and execute.
45 auto hlo_module = CreateNewVerifiedModule();
46 hlo_module->AddEntryComputation(builder.Build());
47 auto result = ExecuteAndTransfer(std::move(hlo_module), {});
48
49 EXPECT_TRUE(LiteralTestUtil::Near(LiteralUtil::CreateR0<float>(42.0), result,
50 error_spec_));
51}
52
53XLA_TEST_F(BroadcastTest, BroadcastScalarTo2D) {
54 auto builder = HloComputation::Builder(TestName());

Callers

nothing calls this directly

Calls 9

TestNameFunction · 0.85
MakeShapeFunction · 0.85
NearFunction · 0.85
LiteralSliceClass · 0.85
AddEntryComputationMethod · 0.80
BuilderClass · 0.50
AddInstructionMethod · 0.45
BuildMethod · 0.45
FillMethod · 0.45

Tested by

no test coverage detected