Add twenty ops to candle-onnx and fix float-exact gelu test#3616
Open
NahButch wants to merge 2 commits into
Open
Add twenty ops to candle-onnx and fix float-exact gelu test#3616NahButch wants to merge 2 commits into
NahButch wants to merge 2 commits into
Conversation
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>
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.
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
fmodsemantics, 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_operationcompare 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