赞
踩
先写几个常用的,以后抽时间整理一下吧
[0,∞)
pass
(lim->0 , ∞)
pass
[0,6]
pass
(0,1)
f
(
x
)
=
1
1
+
e
−
x
.
f(x) = \frac{1}{1+e^{-x}}.
f(x)=1+e−x1.
pass
pass
def showAF(x):
y0=relu = F.relu(x)
y1=leakyRelu=F.leaky_relu(x)
y2=sigmoid=torch.sigmoid(x)
y3=relu6 = torch.nn.ReLU6(x)
plt.title('activationFunctions')
plt.plot(x, y0, color='red', label='Relu')
plt.plot(x, y1, '--',color='blue', label='LeakyRelu')
plt.plot(x, y2, '-.', color='green', label='Sigmoid')
plt.plot(x, y3, color='pink', label='ReLU6')
plt.legend()
plt.grid(True,linestyle='--',alpha=0.8)
plt.xlabel('x')
plt.ylabel('y')
plt.show()
x=torch.linspace(-10,10,100)
showAF(x)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。