赞
踩
原型
CLASS torch.nn.Sigmoid(*args, **kwargs)
定义
Applies the element-wise function:
S i g m o i d ( x ) = σ ( x ) = 1 1 + exp ( − x ) Sigmoid(x)=\sigma(x)=\frac{1}{1+\exp(-x)} Sigmoid(x)=σ(x)=1+exp(−x)1
图
代码
import torch
import torch.nn as nn
m = nn.Sigmoid()
input = torch.randn(4)
output = m(input)
print("input: ", input) # input: tensor([-0.8462, 0.7929, -0.5680, -0.5883])
print("output: ", output) # output: tensor([0.3002, 0.6885, 0.3617, 0.3570])
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。