Skip to content

Add twenty ops to candle-onnx and fix float-exact gelu test#3616

Open
NahButch wants to merge 2 commits into
huggingface:mainfrom
NahButch:onnx-op-coverage
Open

Add twenty ops to candle-onnx and fix float-exact gelu test#3616
NahButch wants to merge 2 commits into
huggingface:mainfrom
NahButch:onnx-op-coverage

Conversation

@NahButch

@NahButch NahButch commented Jun 12, 2026

Copy link
Copy Markdown

Implements twenty missing ONNX operators in simple_eval, each following the operator spec and covered by a test with hand-computed expected values (83 tests pass):

Activations / elementwise: Softplus, Softsign, HardSigmoid, Elu, Celu, Mish, Shrink, ThresholdedRelu, Round (spec half-to-even, which plain f32 rounding gets wrong), Reciprocal, Mod (both sign-of-divisor default and fmod semantics, computed in f64 so integer dtypes are exact)

Normalization: LpNormalization, InstanceNormalization (#3170), GroupNormalization

Reduction / structure: GlobalMaxPool, Hardmax, variadic Max/Sum/Mean, EyeLike (with k offset), TopK (values + indices outputs, any axis, largest/smallest)

Also makes test_gelu_operation compare at 4 decimals instead of exact f32 equality; it currently fails on main by one ulp (0.8413447 vs 0.8413448) after upstream math changes.

Fixes #3170

🤖 Generated with Claude Code

NahButch and others added 2 commits June 12, 2026 17:03
Implements Softplus, Shrink, Softsign, HardSigmoid, Elu, Mish,
LpNormalization, InstanceNormalization (huggingface#3170), and GroupNormalization
in simple_eval, each following the ONNX operator spec and covered by a
test with hand-computed expected values.

Also makes test_gelu_operation compare at 4 decimals instead of exact
f32 equality; it currently fails on main by one ulp (0.8413447 vs
0.8413448) after upstream math changes.

Fixes huggingface#3170

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GlobalMaxPool, ThresholdedRelu, Round (spec half-to-even, which plain
f32 rounding gets wrong), Reciprocal, variadic Max/Sum/Mean, Mod (both
sign-of-divisor default and fmod semantics, computed in f64 so integer
dtypes are exact), Hardmax, Celu, EyeLike (with k offset), and TopK
(values + indices outputs, any axis, largest/smallest).

Each follows the ONNX operator spec and is covered by a test with
hand-computed expected values.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@NahButch NahButch changed the title Add nine ops to candle-onnx and fix float-exact gelu test Add twenty ops to candle-onnx and fix float-exact gelu test Jun 12, 2026
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.

Supports InstanceNormalization in onnx

1 participant