Shortcuts

Mish

class torch.nn.Mish(inplace=False)[源代码]

逐元素应用Mish函数。

Mish: 一种自正则化的非单调神经激活函数。

Mish(x)=xTanh(Softplus(x))\text{Mish}(x) = x * \text{Tanh}(\text{Softplus}(x))
Shape:
  • 输入:()(*),其中 * 表示任意数量的维度。

  • 输出: ()(*), 与输入形状相同。

../_images/Mish.png

示例:

>>> m = nn.Mish()
>>> input = torch.randn(2)
>>> output = m(input)
优云智算