| 219 | } |
| 220 | |
| 221 | StatusOr<std::unique_ptr<HloModule>> HloTestBase::MakeReferenceModule( |
| 222 | const HloModule& test_module, |
| 223 | const std::function<void(HloModule*)>& reference_preprocessor) { |
| 224 | std::unique_ptr<HloModule> reference_module = test_module.Clone(); |
| 225 | const auto& program_shape = GetProgramShapeWithLayout(test_module); |
| 226 | |
| 227 | if (reference_preprocessor != nullptr) { |
| 228 | reference_preprocessor(reference_module.get()); |
| 229 | if (!ProgramShapesEqual(program_shape, |
| 230 | GetProgramShapeWithLayout(*reference_module))) { |
| 231 | return InvalidArgument( |
| 232 | "reference preprocessor must not modify the program shape"); |
| 233 | } |
| 234 | } |
| 235 | TF_RETURN_IF_ERROR(hlo_verifier_->Run(reference_module.get()).status()); |
| 236 | return std::move(reference_module); |
| 237 | } |
| 238 | |
| 239 | StatusOr<::testing::AssertionResult> HloTestBase::RunAndCompareInternal( |
| 240 | std::unique_ptr<HloModule> module, |
nothing calls this directly
no test coverage detected