[Relax][ONNX] Drop NaN-preservation isnan-where wrappers#19847
Merged
Conversation
…ndefined) Remove the explicit NaN-preservation guards added in the ONNX frontend for Relu (apache#19750), Sign (apache#19674), Clip's input (apache#19535), and ReduceMax/ReduceMin (the _reduce_min_max_preserve_nan helper, apache#19750). Each paid an extra isnan + where -- the reduce helper a full sum(isnan) pass -- over the data solely to force a NaN input through, a corner case that mostly shows up in fuzzing. NaN handling for these ops is now left unspecified, matching the less-strict but efficient direction: relu/sign reduce to the plain relax op and ReduceMax/ReduceMin to relax.op.max/min. Clip keeps the cheap scalar NaN-bound sanitization: a NaN min/max bound is still treated as unbounded (ORT parity), which is a distinct concern from per-element input-NaN passthrough. Drop the corresponding tests: test_relu_nan_preserve, test_sign_nan_preserve, test_reduce_min_max_nan_preserve, and the NaN-input case of test_clip_v13.
Contributor
There was a problem hiding this comment.
Code Review
This pull request removes custom NaN-preserving logic and its associated helper function _reduce_min_max_preserve_nan from several ONNX operators in the Relax frontend, including Clip, Relu, ReduceMax, ReduceMin, and Sign. Consequently, the corresponding unit tests verifying NaN preservation behavior for these operators have also been removed. I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
tqchen
approved these changes
Jun 19, 2026
Member
|
Thanks @tlopex! |
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.
This pr removes the explicit NaN-preservation guards added in the ONNX frontend for Relu (#19750), Sign (#19674), Clip's input (#19535), and ReduceMax/ReduceMin (the _reduce_min_max_preserve_nan helper, #19750). Each paid an extra isnan + where -- the reduce helper a full sum(isnan) pass
This pr also drops the corresponding tests: test_relu_nan_preserve, test_sign_nan_preserve, test_reduce_min_max_nan_preserve, and the NaN-input case of test_clip_v13.
PRs about NaN-preservation updated in backend will be followed up in the future