Repository navigation
fix: correct conv/pool padding, reshape 0/-1, reject unsupported ops at load - #3
Merged
Merged
Conversation
…at load - Resolve real per-side pads (incl. auto_pad SAME_UPPER/SAME_LOWER/VALID) instead of averaging asymmetric pads; uneven pads are applied to the input explicitly (zeros for conv, -inf for max pool, mask-normalized for avg pool with count_include_pad=0). - Pass ceil_mode through to pooling. - Reshape: read shape from parsed config (supports opset<5 attribute) and fix divide-by-zero when the target shape contains both 0 and -1. - load_onnx now errors listing unsupported ops instead of skipping them at inference time. - Add tests/test_ops.py comparing edge cases against ONNX Runtime; run in CI. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 5, 2026
Latest onnx writes IR 14 while latest onnxruntime reads up to 13, which broke compare_ort.py. Also drop the main-only pull_request filter so stacked PRs are checked. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes several cases where the interpreter silently produced wrong output shapes/values or panicked.
(top+bottom)/2), giving wrong output shapes. Uneven pads are now applied to the input explicitly — zeros for conv,-inffor max pool, and a padded ones-mask normalization for avg pool withcount_include_pad=0so padding never counts toward the average.auto_pad:SAME_UPPER/SAME_LOWER/VALIDwere ignored (treated as no padding). Pads are now computed from the input shape per the ONNX spec. Common in TF-exported models.ceil_mode: was hard-coded tofalsein pooling; now passed through.0and-1(e.g.[0, -1]) panicked with divide-by-zero. Shape is now read from onnx-ir's parsed config, which also covers the opset < 5shapeattribute.load_onnxnow raisesRuntimeError: unsupported ONNX op(s): ...instead of skipping them with a warning and failing (or misbehaving) at inference time.Shared padding logic lives in the new
src/interpreter/ops/padding.rs.Testing
New
tests/test_ops.pybuilds single-node models on the fly and compares against ONNX Runtime (15 cases: conv padding modes, pooling, reshape, load error). Added to CI.test_bridge.pyandcompare_ort.pystill pass;cargo fmt --checkandclippy -D warningsclean.Known limitation
AveragePool
dilationis still ignored — Burn'savg_pool2ddoesn't take a dilation parameter (unchanged from before).🤖 Generated with Claude Code