| 237 | } |
| 238 | |
| 239 | StatusOr<::testing::AssertionResult> HloTestBase::RunAndCompareInternal( |
| 240 | std::unique_ptr<HloModule> module, |
| 241 | const absl::Span<Literal* const> arguments, |
| 242 | const optional<ErrorSpec>& error, bool run_hlo_passes, |
| 243 | const std::function<void(HloModule*)>& reference_preprocessor) { |
| 244 | TF_RETURN_IF_ERROR(hlo_verifier_->Run(module.get()).status()); |
| 245 | TF_ASSIGN_OR_RETURN(auto reference_module, |
| 246 | MakeReferenceModule(*module, reference_preprocessor)); |
| 247 | |
| 248 | // Execute on two backends. |
| 249 | TF_ASSIGN_OR_RETURN( |
| 250 | auto test, |
| 251 | test_runner_.Execute(std::move(module), arguments, run_hlo_passes)); |
| 252 | TF_ASSIGN_OR_RETURN(auto reference, |
| 253 | reference_runner_.Execute(std::move(reference_module), |
| 254 | arguments, run_hlo_passes)); |
| 255 | return LiteralTestUtil::NearOrEqual(/*expected=*/reference, /*actual=*/test, |
| 256 | error); |
| 257 | } |
| 258 | |
| 259 | ::testing::AssertionResult HloTestBase::RunAndCompare( |
| 260 | std::unique_ptr<HloModule> module, |