Skip to content

Commit

Permalink
Optimize the implmentation of swish operator (apache#10655)
Browse files Browse the repository at this point in the history
  • Loading branch information
heliqi authored and pfk-beta committed Apr 11, 2022
1 parent bf44437 commit b849843
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/tvm/relay/frontend/paddlepaddle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1937,8 +1937,9 @@ def convert_swish(g, op, block):
"""Operator converter for swish."""

x = g.get_node(op.input("X")[0])
dtype = infer_type(x).checked_type.dtype
out = x / (_op.const(1.0, dtype) + _op.exp(_op.const(-1.0, dtype) * x))
beta = op.attr("beta")
assert beta == 1.0, "Only support beta==1.0 for PaddlePaddle's swish"
out = x * _op.tensor.sigmoid(x)
g.add_node(op.output("Out")[0], out)


Expand Down

0 comments on commit b849843

Please sign in to comment.