onnx_light.backend.runtime_coverage#
Runtime coverage report for the backend test cases.
This module compares every backend test case collected by
onnx_light.backend.test.case.base.collect_test_case() against three
independent runtime / static-analysis scenarios:
onnxruntime CPU — the model is executed with
onnxruntimeon the CPU execution provider and the maximum absolute discrepancy between the reference outputs and the ORT outputs is recorded;static shape — the model is passed to
onnx_light.onnx_lib.shape_inference.infer_shapes()with the original (numeric) input shapes;dynamic shapes — every numeric input dimension is replaced with a symbolic
dim_param(so identical numeric values share the same symbol) and shape inference is run on the resulting symbolic model.
The result is a RuntimeCoverageReport containing one
TestCaseStatus per backend test case, plus aggregate statistics per
domain and globally.
- class onnx_light.backend.runtime_coverage.DomainSummary(domain: str, total: int = 0, onnxruntime_ok: int = 0, static_shape_ok: int = 0, dynamic_shapes_ok: int = 0)#
Aggregated pass counts for a single domain.
- class onnx_light.backend.runtime_coverage.RuntimeCoverageReport(statuses: list[TestCaseStatus] = <factory>, summaries: dict[str, ~onnx_light.backend.runtime_coverage.DomainSummary]=<factory>, overall: DomainSummary = <factory>)#
Per-test-case runtime coverage report.
The
statuseslist contains oneTestCaseStatusper collected test case.summariesgroups the statuses by domain and counts how many test cases pass each scenario, andoverallis the same aggregation across every test case.
- class onnx_light.backend.runtime_coverage.TestCaseStatus(name: str, op_type: str, domain: str, onnxruntime_cpu: float | None, onnxruntime_error: str | None, static_shape: bool, static_shape_error: str | None, dynamic_shapes: bool, dynamic_shapes_error: str | None)#
Outcome of the three runtime scenarios for one backend test case.
- onnx_light.backend.runtime_coverage.compute_runtime_coverage(test_cases: Iterable[TestCase] | None = None) RuntimeCoverageReport#
Builds the runtime coverage report for every backend test case.
- Parameters:
test_cases – Optional iterable of
TestCaseto evaluate. WhenNone,collect_test_case()is invoked to gather every available test case.- Returns:
A populated
RuntimeCoverageReport.
- onnx_light.backend.runtime_coverage.render_rst_domain_summary(report: RuntimeCoverageReport) str#
Renders one row per domain with its individual pass percentages.
- onnx_light.backend.runtime_coverage.render_rst_domain_tabs(report: RuntimeCoverageReport, css_class: str | None = 'sphinx-datatable') str#
Renders one
tab-itemper domain, each containing a coverage table.
- onnx_light.backend.runtime_coverage.render_rst_summary(report: RuntimeCoverageReport) str#
Renders the global pass-percentage summary as a reST
list-table.
- onnx_light.backend.runtime_coverage.render_rst_table_for_domain(report: RuntimeCoverageReport, domain: str, css_class: str | None = None, indent: str = '') str#
Renders the per-test-case table for one
domainas a reSTlist-table.- Parameters:
report – The runtime coverage report.
domain – ONNX operator domain to filter on (e.g.
""for the defaultai.onnxdomain).css_class – When provided, a
:class:option is emitted on thelist-tabledirective. Pass"sphinx-datatable"to opt into the interactive DataTables widget.indent – Optional whitespace prefix prepended to every output line — useful to inline the table inside a
tab-itemdirective.