Skip to content

[Relax][ONNX] Add Celu operator support - #20923

Merged
mshr-h merged 1 commit into
apache:mainfrom
Anirudh-65:celu-impl
Nov 6, 2026
Merged

mshr-h merged 1 commit into
apache:mainfrom
Anirudh-65:celu-impl

Conversation

@Anirudh-65

Copy link
Copy Markdown
Contributor

This commit adds support for the ONNX Celu (Continuously Differentiable Exponential Linear Unit) operator in the Relax ONNX frontend.

Celu is computed element-wise as:
celu(x) = max(0, x) + min(0, alpha * (exp(x / alpha) - 1))
= -alpha * relu(1 - exp(x / alpha)) + relu(x)

Changes include:

  • Added Celu converter class in python/tvm/relax/frontend/onnx/onnx_frontend.py with _impl_v12 supporting the alpha attribute (defaulting to 1.0).
  • Registered "Celu" in the operator converter map.
  • Added structural IR equivalence tests (test_celu_ir) and numerical correctness tests against ONNX Runtime (test_celu) in tests/python/relax/test_frontend_onnx.py.

This commit adds support for the ONNX Celu (Continuously Differentiable
Exponential Linear Unit) operator in the Relax ONNX frontend.

Celu is computed element-wise as:
  celu(x) = max(0, x) + min(0, alpha * (exp(x / alpha) - 1))
          = -alpha * relu(1 - exp(x / alpha)) + relu(x)

Changes include:
- Added `Celu` converter class in `python/tvm/relax/frontend/onnx/onnx_frontend.py`
  with `_impl_v12` supporting the `alpha` attribute (defaulting to 1.0).
- Registered "Celu" in the operator converter map.
- Added structural IR equivalence tests (`test_celu_ir`) and numerical
  correctness tests against ONNX Runtime (`test_celu`) in
  `tests/python/relax/test_frontend_onnx.py`.
@Anirudh-65

Copy link
Copy Markdown
Contributor Author

Hi @mshr-h, @yzhliu, @tqchen, @akaashrp

Could you please take a look at this PR when you get a chance?

@mshr-h mshr-h self-assigned this Nov 6, 2026
@mshr-h
mshr-h merged commit 0054a95 into apache:main Nov 6, 2026
8 checks passed
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