Skip to content

[Relax][ONNX] Drop NaN-preservation isnan-where wrappers#19847

Merged
tqchen merged 1 commit into
apache:mainfrom
tlopex:drop-onnx-isnan-where
Jun 20, 2026
Merged

[Relax][ONNX] Drop NaN-preservation isnan-where wrappers#19847
tqchen merged 1 commit into
apache:mainfrom
tlopex:drop-onnx-isnan-where

Conversation

@tlopex

@tlopex tlopex commented Jun 19, 2026

Copy link
Copy Markdown
Member

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

…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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 tqchen merged commit 59af03c into apache:main Jun 20, 2026
11 checks passed
@guan404ming

Copy link
Copy Markdown
Member

Thanks @tlopex!

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.

3 participants