| 45 | |
| 46 | |
| 47 | def _summarize(report: Any) -> None: |
| 48 | print(f"suite={report.suite_name} passed={report.passed} pass_rate={report.pass_rate:.4f}") |
| 49 | for candidate in report.candidates: |
| 50 | print( |
| 51 | f"candidate={candidate.candidate_name} backend={candidate.backend} " |
| 52 | f"passed={candidate.passed} pass_rate={candidate.pass_rate:.4f}" |
| 53 | ) |
| 54 | for case in candidate.cases: |
| 55 | for output in case.outputs: |
| 56 | label = f" {output.message}" if output.message else "" |
| 57 | print( |
| 58 | f" case={case.case_name} output={output.output_index}{label} " |
| 59 | f"shape={output.shape} dtype={output.candidate_dtype} " |
| 60 | f"max_abs={output.max_abs_error:.8e} " |
| 61 | f"mean_abs={output.mean_abs_error:.8e} " |
| 62 | f"max_rel={output.max_rel_error:.8e} " |
| 63 | f"tol=(atol={output.atol:.3e}, rtol={output.rtol:.3e}) " |
| 64 | f"passed={output.passed}" |
| 65 | ) |
| 66 | |
| 67 | |
| 68 | def parse_args() -> argparse.Namespace: |