nn.Sigmoid

torch.nn.Sigmoid

官方文档: sigmoid

Applies the element-wise function

Sigmoid的函数图像如下所示

下面对函数的参数进行解释

torch.nn.Sigmoid

  • input: 输入tensor

使用方法很简单,如下

1
2
3
4
5
6
7
8
9
10
11
x = torch.tensor([1., 2., 3.])
m = torch.nn.Sigmoid()
y = m(x)

'''
x
tensor([1., 2., 3.])

y
tensor([0.7311, 0.8808, 0.9526])
'''