pytorch之---relu,prelu,leakyrelu

torch.nn.ReLU(inplace=False):output = max(0, x)

 

torch.nn.PReLU(num_parameters=1, init=0.25):$PReLU(x) = max(0,x) + a * min(0,x)

a是一个可学习参数。当没有声明时,nn.PReLU()在所有的输入中只有一个参数a;如果是nn.PReLU(nChannels),a将应用到每个输入。

注意:当为了表现更佳的模型而学习参数a时不要使用权重衰减(weight decay)

参数:

    num_parameters:需要学习的a的个数,默认等于1
    init:a的初始值,默认等于0.25

 

torch.nn.LeakyReLU(negative_slope=0.01, inplace=False)

对输入的每一个元素运用$f(x) = max(0, x) + {negative_slope} * min(0, x)$

参数:

    negative_slope:控制负斜率的角度,默认等于0.01
    inplace-选择是否进行覆盖运算

torch.nn.ReLU6(inplace=False):  output = min(max(0,x), 6)

关于relu6,请参考:https://www.cnblogs.com/bmsl/p/9005431.html

 

torch.nn.RReLU(lower=0.125, upper=0.3333333333333333, inplace=False)

RReLU(x)=\left\{\begin{matrix} x (if x>0)& & \\ ax (other) & & \end{matrix}\right.

where aa is randomly sampled from uniform distribution U(lower,upper)U(lower,upper).

    See: https://arxiv.org/pdf/1505.00853.pdf
---------------------  
作者:儒雅的小Z  
来源:CSDN  
原文:https://blog.csdn.net/guilutian0541/article/details/81119932  
版权声明:本文为博主原创文章,转载请附上博文链接!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值