Mish

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

逐元素应用Mish函数。

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

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

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

{BASE_RAW_UPLOAD_URL}/pytorch-doc-2.5/5e2c9f1ab0f3074838e17be0d44d3950.png

示例:

>>> m = nn.Mish()
>>> input = torch.randn(2)
>>> output = m(input)
本页目录