Mr-Neutr0n opened a new pull request, #18773: URL: https://github.com/apache/tvm/pull/18773
## Description Fixes #18750 The ONNX frontend `Gelu` converter was hardcoded to always emit `R.nn.gelu`, ignoring the `approximate` attribute introduced in ONNX Opset 20. When a model uses `approximate="tanh"`, TVM would silently produce incorrect results by applying the exact erf-based Gelu instead of the tanh approximation. ## Changes Added `_impl_v20` to the `Gelu` converter class that checks the `approximate` attribute: - `approximate="tanh"` → routes to `relax.op.nn.gelu_tanh` - `approximate="none"` (default) → routes to `relax.op.nn.gelu` The existing `_impl_v1` is left untouched for backward compatibility with the Microsoft onnxruntime contrib opset. The version dispatch mechanism will automatically select `_impl_v20` for Opset 20+ models. ## Testing - The change is a straightforward attribute check that routes to an already-existing and tested operator (`R.nn.gelu_tanh`). - No new dependencies introduced. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
