From 6ceade790833d4f4337502aa882758dee70c3a0c Mon Sep 17 00:00:00 2001 From: Marcel Dudek Date: Wed, 27 Aug 2025 14:18:50 +0200 Subject: [PATCH] Use relax softplus operator in onnx frontend --- python/tvm/relax/frontend/onnx/onnx_frontend.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/tvm/relax/frontend/onnx/onnx_frontend.py b/python/tvm/relax/frontend/onnx/onnx_frontend.py index b91106e64a91..05e4534acae3 100644 --- a/python/tvm/relax/frontend/onnx/onnx_frontend.py +++ b/python/tvm/relax/frontend/onnx/onnx_frontend.py @@ -1698,7 +1698,8 @@ class Softplus(OnnxOpConverter): @classmethod def _impl_v1(cls, bb, inputs, attr, params): dtype = inputs[0].struct_info.dtype - return relax.op.log(relax.op.exp(inputs[0]) + relax.const(1, dtype=dtype)) + threshold = 10.0 if dtype == "float16" else 20.0 + return relax.op.nn.softplus(inputs[0], threshold=threshold) class Softsign(OnnxOpConverter):