Skip to content

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

Open
Anirudh-65 wants to merge 1 commit into
apache:mainfrom
Anirudh-65:celu-impl
Open

Anirudh-65 wants to merge 1 commit into
apache:mainfrom
Anirudh-65:celu-impl

Conversation

@Anirudh-65

Copy link
Copy Markdown

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

This branch has not been deployed

No deployments
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.

1 participant