mish

paddle.nn.functional. mish ( x: Tensor, name: str | None = None ) Tensor [source]

mish activation.

softplus(x)={x,if x>thresholdln(1+ex),otherwisemish(x)=xtanh(softplus(x))
Parameters
  • x (Tensor) – The input Tensor with data type float32, float64.

  • name (str|None, 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])