mish¶
mish 激活层。计算公式如下:
softplus(x)={x,if x>thresholdln(1+ex),otherwiseMish(x)=x∗tanh(softplus(x))
返回¶
Tensor
,数据类型和形状同x
一致。
代码示例¶
>>> 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])