jiangjiajun commented on code in PR #14160:
URL: https://github.com/apache/tvm/pull/14160#discussion_r1127280165
##########
python/tvm/relay/frontend/paddlepaddle.py:
##########
@@ -1084,6 +1084,21 @@ def convert_meshgrid(g, op, block):
g.add_node(op.output("Out")[i], out)
+def convert_mish(g, op, block):
+ """Operator converter for mish."""
+
+ x = g.get_node(op.input("X")[0])
+ dtype = infer_type(x).checked_type.dtype
+ threshold = _expr.const(op.attr("threshold"), dtype=dtype)
+ exp = _op.exp(x)
+ add = _op.add(exp, _expr.const(1.0, dtype))
+ log = _op.log(add)
+ softplus = _op.where(x > threshold, x, log)
+ tanh = _op.tanh(softplus)
+ out = _op.multiply(x, tanh)
+ g.add_node(op.output("Out")[0], out)
Review Comment:

I think we only need to implement this formula, there's no need to process
situation that `beta * x > threshold`, it's just a strategy to make calculation
stable.
--
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]