Skip to content

test(e2e): add dynamic-axes e2e tests for export, config, build, perf#1127

Merged
xieofxie merged 1 commit into
mainfrom
hualxie/more_e2e
Jul 17, 2026
Merged

test(e2e): add dynamic-axes e2e tests for export, config, build, perf#1127
xieofxie merged 1 commit into
mainfrom
hualxie/more_e2e

Conversation

@xieofxie

Copy link
Copy Markdown
Contributor

Summary

Adds end-to-end coverage for the shared --dynamic-axes option, which had no e2e tests. The flag is exposed by four commands — export, config, build, and perf — and this PR exercises each with microsoft/resnet-50 (single pixel_values input, logits output).

--dynamic-axes takes a JSON mapping of tensor name → {axis: symbolic_name} and marks those axes as symbolic (dim_param) in the exported ONNX instead of fixed integers.

What's covered

Each test lives in the existing per-command e2e file, reusing its helpers/fixtures:

  • test_export_e2e.pyTestExportDynamicAxes
    • Batch axis becomes symbolic (dim_param="batch") and propagates to logits; channel/spatial dims stay static.
    • Baseline contrast: without the flag all input dims are fixed [1, 3, 224, 224].
    • Multiple symbolic axes (batch / height / width).
    • Invalid spec (empty dim name) fails cleanly with no ONNX written.
  • test_config_e2e.pyTestConfigDynamicAxes
    • Mapping is recorded under export.dynamic_axes; absent by default; multi-axis mapping preserved.
  • test_build_e2e.pyTestBuildDynamicAxes
    • Symbolic batch dim survives the full export → optimize build pipeline.
  • test_perf_e2e.pyTestPerfDynamicAxes
    • --ignore-cache --no-skip-build re-exports, so the benchmarked model reports a dynamic (None) batch axis and the running ONNX carries dim_param="batch".

Note: quantize also has a "dynamic" concept, but that is a quantization mode (dynamic quantization) and not --dynamic-axes, so it is intentionally excluded.

Notes

  • Assertions are grounded in observed CLI behavior, not assumptions.
  • No hardcoded architecture logic — tests key off the model's real input name pixel_values, consistent with the existing resnet-50 e2e suite.
  • All 9 new tests pass locally (uv run pytest -m e2e ...); ruff check is clean.

Cover the shared --dynamic-axes option across the four commands that support it, using microsoft/resnet-50: export marks the named input axis symbolic (dim_param) and propagates it to logits, config records the mapping under export.dynamic_axes, the symbolic batch dim survives a full build, and perf re-exports so the benchmarked model exposes a dynamic batch axis.
@xieofxie
xieofxie requested a review from a team as a code owner July 17, 2026 02:53
@xieofxie
xieofxie merged commit fd593e1 into main Jul 17, 2026
9 checks passed
@xieofxie
xieofxie deleted the hualxie/more_e2e branch July 17, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants