Skip to content

[CUDA] Fix clip operator #25057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 14, 2025
Merged

[CUDA] Fix clip operator #25057

merged 2 commits into from
Jun 14, 2025

Conversation

tianleiwu
Copy link
Contributor

@tianleiwu tianleiwu commented Jun 14, 2025

Description

The result of Clip op is not expected when min > max for CUDA. This fixes the implementation to align with operator spec: https://onnx.ai/onnx/operators/onnx__Clip.html

Motivation and Context

ONNX backend test failure with onnx 1.18:

python onnx_backend_test_series.py
======================================================================
FAIL: test_clip_min_greater_than_max_cuda (__main__.OnnxBackendNodeModelTest)
----------------------------------------------------------------------
DESIRED: array([1., 1., 1.], dtype=float32)
ACTUAL: array([2., 2., 1.], dtype=float32)

@tianleiwu tianleiwu requested a review from titaiwangms June 14, 2025 00:06
@tianleiwu tianleiwu requested a review from snnn June 14, 2025 02:13
@snnn snnn merged commit b3c316f into main Jun 14, 2025
89 checks passed
@snnn snnn deleted the tlwu/fix_clip branch June 14, 2025 18:44
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.

2 participants