onnx: add LpNormalization, MeanVarianceNormalization, GroupNormalization, RotaryEmbedding op handlers#2283
Merged
Conversation
…ion, RotaryEmbedding op handlers Import handlers for four standardized ai.onnx operators, lowering to existing tract primitives: - LpNormalization (opset 1), MeanVarianceNormalization (opset 13) - GroupNormalization (opset 18 & 21; opset-aware affine, f32 stash_type) - RotaryEmbedding (opset 23; 3D/4D input, position_ids, partial + interleaved) Corresponding ONNX backend node tests enabled in suite-onnx/node.txt. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kali
approved these changes
May 26, 2026
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
Adds ONNX importer handlers for four inference-relevant operators that tract could already compute as decomposed subgraphs but had no single-node binding for — continuing the recent Attention/RMSNorm/Gelu/Swish/Mish additions:
Reduce<L1|L2>overaxis, then divide[num_groups]pre-21,[C]from 21) and honorsstash_type(f32 reduction for f16/bf16 inputs)position_ids, partialrotary_embedding_dim, NeoX and GPT-J (interleaved) layoutsAll lower to existing tract primitives — importer coverage, no new kernels.
Tests
test-rt/suite-onnx/node.txt, green ondefault+unoptimizedruntimes (GroupNorm at both the opset-18 and opset-21 affine paths; all 8 RoPE variants). Full node suite: 4428 passed / 0 failed.ReferenceEvaluatoron small multi-op graphs, including dynamic (symbolic) batch/sequence shapes; RoPE bit-exact.Note
tract resolves ops by name regardless of domain; this PR targets the standardized
ai.onnxoperators. Thecom.microsoftRoPE variant has a different input order and is intentionally out of scope here.