| 34 | class BroadcastTest : public HloTestBase {}; |
| 35 | |
| 36 | XLA_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 | |
| 53 | XLA_TEST_F(BroadcastTest, BroadcastScalarTo2D) { |
| 54 | auto builder = HloComputation::Builder(TestName()); |
nothing calls this directly
no test coverage detected