torch.nn.Mish
原型
CLASS torch.nn.Mish(inplace=False)
定义
Mish ( x ) = x ∗ Tanh ( Softplus ( x ) ) \text{Mish}(x)=x∗ \text{Tanh}(\text{Softplus}(x)) Mish(x)=x∗Tanh(Softplus(x))
图
代码
import torch
import torch.nn as nn
m = nn.Mish()
input = torch.randn(4)
output = m(input)
print("input: ", input)
print("output: ", output)