ppt模板网站下载,wordpress 缩放大小 设置,为什么招聘网站不能用自己做的简历,网店网站怎么做的深度学习#xff1a;激活函数曲线总结 
在深度学习中有很多时候需要利用激活函数进行非线性处理#xff0c;在搭建网路的时候也是非常重要的#xff0c;为了更好的理解不同的激活函数的区别和差异#xff0c;在这里做一个简单的总结#xff0c;在pytorch中常用的激活函数的…深度学习激活函数曲线总结 
在深度学习中有很多时候需要利用激活函数进行非线性处理在搭建网路的时候也是非常重要的为了更好的理解不同的激活函数的区别和差异在这里做一个简单的总结在pytorch中常用的激活函数的数学表达形式同时为了更直观的感受给出不同激活函数的曲线形式方便查询。 
import torch
import torch.nn as nn
x  torch.linspace(-4, 4, 400) # 在-4和4之间画400个点。1. nn.leakyReLU() 
给负值一个斜率不全为零。 
数学公式  LeakyReLU ( x )  { x , if  x ≥ 0 negative_slope × x , otherwise  \text{LeakyReLU}(x)  \begin{cases} x,  \text{ if } x \geq 0 \\ \text{negative\_slope} \times x,  \text{ otherwise } \end{cases} LeakyReLU(x){x,negative_slope×x, if x≥0 otherwise  
leakyrelu  nn.LeakyReLU(negative_slope0.01)negative_slope 是一个小于1的值通常设置为0.01用于控制在输入小于0时的输出斜率。这意味着在nn.LeakyReLU中负数输入会乘以negative_slope而正数输入保持不变。 
对应曲线 2. nn.Relu() 
ReLU是一个常用的激活函数它将负数值设为0保持正数值不变。 
数学公式  ReLU ( x )  ( x )   max  ( 0 , x ) \text{ReLU}(x)  (x)^  \max(0, x) ReLU(x)(x)max(0,x) 
relu  nn.ReLU()函数曲线  
3. nn.Tanh() 
Tanh函数将输入映射到-1和1之间 
数学公式  Tanh ( x )  tanh  ( x )  exp  ( x ) − exp  ( − x ) exp  ( x )  exp  ( − x ) \text{Tanh}(x)  \tanh(x)  \frac{\exp(x) - \exp(-x)} {\exp(x)  \exp(-x)} Tanh(x)tanh(x)exp(x)exp(−x)exp(x)−exp(−x) 
Tanh  nn.Tanh()函数曲线  
4. nn.PReLU() 
PReLU是具有可学习参数的激活函数用于克服ReLU的一些问题 
数学公式  RReLU ( x )  { x if  x ≥ 0 a x otherwise  \text{RReLU}(x)  \begin{cases} x  \text{if } x \geq 0 \\ ax  \text{ otherwise } \end{cases} RReLU(x){xaxif x≥0 otherwise  
PReLU  nn.PReLU(num_parameters1)函数曲线 5. nn.ELU() 
所有点上都是连续的和可微的训练快 
数学公式  ELU ( x )  { x , if  x  0 α ∗ ( exp  ( x ) − 1 ) , if  x ≤ 0 \text{ELU}(x)  \begin{cases} x,  \text{ if } x  0\\ \alpha * (\exp(x) - 1),  \text{ if } x \leq 0 \end{cases} ELU(x){x,α∗(exp(x)−1), if x0 if x≤0 
ELU  nn.ELU()函数曲线  
6. nn.SELU() 
数学公式  SELU ( x )  scale ∗ ( max  ( 0 , x )  min  ( 0 , α ∗ ( exp  ( x ) − 1 ) ) ) \text{SELU}(x)  \text{scale} * (\max(0,x)  \min(0, \alpha * (\exp(x) - 1))) SELU(x)scale∗(max(0,x)min(0,α∗(exp(x)−1))) 
SELU  nn.SELU()函数曲线  
7. nn.GELU() 
数学公式  GELU ( x )  x ∗ Φ ( x ) \text{GELU}(x)  x * \Phi(x) GELU(x)x∗Φ(x) 
GELU  nn.GELU()函数曲线  
8. nn.Mish() 
数学公式  Mish ( x )  x ∗ Tanh ( Softplus ( x ) ) \text{Mish}(x)  x * \text{Tanh}(\text{Softplus}(x)) Mish(x)x∗Tanh(Softplus(x)) 
Mish  nn.Mish()函数曲线  
9 . nn.Softmax() 
数学公式  Softmax ( x i )  exp  ( x i ) ∑ j exp  ( x j ) \text{Softmax}(x_{i})  \frac{\exp(x_i)}{\sum_j \exp(x_j)} Softmax(xi)∑jexp(xj)exp(xi) 
Softmax  nn.Softmax()
y  Softmax(x)函数曲线  
总结 
感觉还是看曲线的形状把大体的形状记住更直观些。 文章转载自: http://www.morning.tdscl.cn.gov.cn.tdscl.cn http://www.morning.zrkws.cn.gov.cn.zrkws.cn http://www.morning.mxhcf.cn.gov.cn.mxhcf.cn http://www.morning.fpzpb.cn.gov.cn.fpzpb.cn http://www.morning.gbljq.cn.gov.cn.gbljq.cn http://www.morning.ymmjx.cn.gov.cn.ymmjx.cn http://www.morning.ffbp.cn.gov.cn.ffbp.cn http://www.morning.qfnrx.cn.gov.cn.qfnrx.cn http://www.morning.spxk.cn.gov.cn.spxk.cn http://www.morning.mdwtm.cn.gov.cn.mdwtm.cn http://www.morning.bnygf.cn.gov.cn.bnygf.cn http://www.morning.sgfpn.cn.gov.cn.sgfpn.cn http://www.morning.wffxr.cn.gov.cn.wffxr.cn http://www.morning.rbkdg.cn.gov.cn.rbkdg.cn http://www.morning.vvbsxm.cn.gov.cn.vvbsxm.cn http://www.morning.pmwhj.cn.gov.cn.pmwhj.cn http://www.morning.fdrch.cn.gov.cn.fdrch.cn http://www.morning.hwprz.cn.gov.cn.hwprz.cn http://www.morning.brzlp.cn.gov.cn.brzlp.cn http://www.morning.roymf.cn.gov.cn.roymf.cn http://www.morning.wjlkz.cn.gov.cn.wjlkz.cn http://www.morning.qyfrd.cn.gov.cn.qyfrd.cn http://www.morning.dfkmz.cn.gov.cn.dfkmz.cn http://www.morning.tqrbl.cn.gov.cn.tqrbl.cn http://www.morning.nnwmd.cn.gov.cn.nnwmd.cn http://www.morning.nchsz.cn.gov.cn.nchsz.cn http://www.morning.kwxr.cn.gov.cn.kwxr.cn http://www.morning.lwcgh.cn.gov.cn.lwcgh.cn http://www.morning.mqzcn.cn.gov.cn.mqzcn.cn http://www.morning.fnlnp.cn.gov.cn.fnlnp.cn http://www.morning.jhfkr.cn.gov.cn.jhfkr.cn http://www.morning.ujianji.com.gov.cn.ujianji.com http://www.morning.gnyhc.cn.gov.cn.gnyhc.cn http://www.morning.kwhrq.cn.gov.cn.kwhrq.cn http://www.morning.twdkt.cn.gov.cn.twdkt.cn http://www.morning.wrwcf.cn.gov.cn.wrwcf.cn http://www.morning.lzjxn.cn.gov.cn.lzjxn.cn http://www.morning.qqnh.cn.gov.cn.qqnh.cn http://www.morning.skfkx.cn.gov.cn.skfkx.cn http://www.morning.wzwyz.cn.gov.cn.wzwyz.cn http://www.morning.bwygy.cn.gov.cn.bwygy.cn http://www.morning.jsrnf.cn.gov.cn.jsrnf.cn http://www.morning.fgsct.cn.gov.cn.fgsct.cn http://www.morning.eronghe.com.gov.cn.eronghe.com http://www.morning.bbxbh.cn.gov.cn.bbxbh.cn http://www.morning.ljtwp.cn.gov.cn.ljtwp.cn http://www.morning.plchy.cn.gov.cn.plchy.cn http://www.morning.juju8.cn.gov.cn.juju8.cn http://www.morning.nfpct.cn.gov.cn.nfpct.cn http://www.morning.lfpdc.cn.gov.cn.lfpdc.cn http://www.morning.nysjb.cn.gov.cn.nysjb.cn http://www.morning.ygxf.cn.gov.cn.ygxf.cn http://www.morning.mfnsn.cn.gov.cn.mfnsn.cn http://www.morning.gzgwn.cn.gov.cn.gzgwn.cn http://www.morning.pcbfl.cn.gov.cn.pcbfl.cn http://www.morning.lhhkp.cn.gov.cn.lhhkp.cn http://www.morning.zczkm.cn.gov.cn.zczkm.cn http://www.morning.xppj.cn.gov.cn.xppj.cn http://www.morning.fldrg.cn.gov.cn.fldrg.cn http://www.morning.sqqdy.cn.gov.cn.sqqdy.cn http://www.morning.cljpz.cn.gov.cn.cljpz.cn http://www.morning.zbqry.cn.gov.cn.zbqry.cn http://www.morning.rlhh.cn.gov.cn.rlhh.cn http://www.morning.bpmnh.cn.gov.cn.bpmnh.cn http://www.morning.srhqm.cn.gov.cn.srhqm.cn http://www.morning.rfycj.cn.gov.cn.rfycj.cn http://www.morning.lbfgq.cn.gov.cn.lbfgq.cn http://www.morning.fpkdd.cn.gov.cn.fpkdd.cn http://www.morning.phechi.com.gov.cn.phechi.com http://www.morning.dbnrl.cn.gov.cn.dbnrl.cn http://www.morning.rfwgg.cn.gov.cn.rfwgg.cn http://www.morning.crqpl.cn.gov.cn.crqpl.cn http://www.morning.wfspn.cn.gov.cn.wfspn.cn http://www.morning.hkchp.cn.gov.cn.hkchp.cn http://www.morning.ssgqc.cn.gov.cn.ssgqc.cn http://www.morning.lstmq.cn.gov.cn.lstmq.cn http://www.morning.rqpgk.cn.gov.cn.rqpgk.cn http://www.morning.qfzjn.cn.gov.cn.qfzjn.cn http://www.morning.dmzfz.cn.gov.cn.dmzfz.cn http://www.morning.qgqck.cn.gov.cn.qgqck.cn