Mish¶
Mish 激活层
\[ \begin{align}\begin{aligned}\begin{split}softplus(x) = \begin{cases} x, \text{if } x > \text{threshold} \\ \ln(1 + e^{x}), \text{otherwise} \end{cases}\end{split}\\Mish(x) = x * \tanh(softplus(x))\end{aligned}\end{align} \]
形状¶
input:任意形状的 Tensor。
output:和 input 具有相同形状的 Tensor。
代码示例¶
import paddle
x = paddle.to_tensor([-5., 0., 5.])
m = paddle.nn.Mish()
out = m(x) # [-0.03357624, 0., 4.99955208]