【PyTorch】教程:torch.nn.Mish

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)=xTanh(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)

【参考】

Mish — PyTorch 1.13 documentation

猜你喜欢

转载自blog.csdn.net/zhoujinwang/article/details/129641546