mish

paddle.nn.functional. mish ( x, name=None ) [source]

mish activation.

\[ \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} \]
Parameters
  • x (Tensor) – The input Tensor with data type float32, float64.

  • name (str, optional) – For details, please refer to Name. Generally, no setting is required. Default: None.

Returns

A Tensor with the same data type and shape as x .

Examples

>>> import paddle
>>> import paddle.nn.functional as F

>>> x = paddle.to_tensor([-5., 0., 5.])
>>> out = F.mish(x)
>>> print(out)
Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
[-0.03357624,  0.        ,  4.99955177])