Skip to content

Commit 472b2fc

Browse files
authored
[Relax] ONNX frontend using relax softplus operator (#18242)
Use relax softplus operator in onnx frontend
1 parent 585d6d2 commit 472b2fc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/tvm/relax/frontend/onnx/onnx_frontend.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1698,7 +1698,8 @@ class Softplus(OnnxOpConverter):
16981698
@classmethod
16991699
def _impl_v1(cls, bb, inputs, attr, params):
17001700
dtype = inputs[0].struct_info.dtype
1701-
return relax.op.log(relax.op.exp(inputs[0]) + relax.const(1, dtype=dtype))
1701+
threshold = 10.0 if dtype == "float16" else 20.0
1702+
return relax.op.nn.softplus(inputs[0], threshold=threshold)
17021703

17031704

17041705
class Softsign(OnnxOpConverter):

0 commit comments

Comments
 (0)