Fix ReduceSumSquare: axes as input per ONNX spec - #76
Merged
Conversation
Per ONNX opset 18+, ReduceSumSquare axes is an optional input tensor, not an attribute. Changed axes=[-1] (keyword arg → attribute) to [-1] (positional arg → input tensor) to match the spec. Affected files: - _gated_deltanet.py: L2 normalization of Q and K (2 sites) - qwen3_tts_tokenizer.py: nearest-neighbor codebook lookup (2 sites) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
titaiwangms
approved these changes
Apr 1, 2026
Performance Comparison
|
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes ONNX opset 18+ compliance for ReduceSumSquare by passing axes as an optional input tensor (not an attribute), aligning graph construction with the ONNX operator schema used at the repo’s default opset (24).
Changes:
- Update
ReduceSumSquare(..., axes=[-1], ...)→ReduceSumSquare(..., [-1], ...)in GatedDeltaNet Q/K L2 normalization. - Update
ReduceSumSquare(..., axes=[-1], ...)→ReduceSumSquare(..., [-1], ...)in Qwen3 TTS tokenizer nearest-codebook distance computation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/mobius/components/_gated_deltanet.py |
Ensures ReduceSumSquare uses axes as an input tensor for opset 18+ when computing per-head L2 norms. |
src/mobius/models/qwen3_tts_tokenizer.py |
Ensures ReduceSumSquare uses axes as an input tensor for opset 18+ in codebook distance calculations. |
🏗️ Architecture Diff
No architecture changes detected. ✅ Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
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.
Per ONNX opset 18+,
ReduceSumSquaretakesaxesas an optional input tensor, not an attribute.Problem
The current code passes
axes=[-1]as a keyword argument, which onnxscript interprets as an attribute. This produces an invalid ONNX graph per the spec.Fix
Change
axes=[-1](attribute) →[-1](positional input tensor), matching the pattern used byReduceSumandReduceMeanthroughout the codebase.Files changed
src/mobius/components/_gated_deltanet.pysrc/mobius/models/qwen3_tts_tokenizer.pyTesting
2219 passed, 29 skipped. Lint clean.