代码地址:https://github.com/lessw2020/mish
1. mish的公式表达和曲线
公式表达:Mish=x * tanh(ln(1+e^x))
曲线表达,如下图所示:
2. mish的pytorch实现
class Mish(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
x = x * (torch.tanh(torch.nn.functional.softplus(x)))
return x
效果还不错,你也试试吧!
本文深入解析了Mish激活函数的数学表达式及其特性,并提供了详细的PyTorch实现代码。Mish函数定义为:Mish = x * tanh(ln(1 + e^x)),其独特的非线性和自适应性质使其在神经网络中表现出色。
1109

被折叠的 条评论
为什么被折叠?



