评价此页

Mish#

class torch.nn.Mish(inplace=False)[source]#

逐元素应用 Mish 函数。

Mish: A Self Regularized Non-Monotonic Neural Activation Function.

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

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

../_images/Mish.png

示例

>>> m = nn.Mish()
>>> input = torch.randn(2)
>>> output = m(input)