XG-zheng commented on code in PR #14160:
URL: https://github.com/apache/tvm/pull/14160#discussion_r1127328608


##########
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 modified the implementation and only process the case of x <= threshold 
(beta = 1.0).



-- 
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]

Reply via email to