欢迎光临散文网 会员登陆 & 注册

pytorch|学习网络中的池化层,全连接层和激活函数

2022-02-23 18:26 作者:深度之眼官方账号  | 我要投稿

来源:投稿 作者:小灰灰

编辑:学姐带你玩AI 公众号


池化层


卷积操作中pool层是比较重要的,是提取重要信息的操作,可以去掉不重要的信息,减少计算开销。



nn.MAXPool2d


功能是对二维信号进行最大池化



练习:




池化前尺寸:torch.Size([1, 3, 512, 512])
池化后尺寸:torch.Size([1, 3, 256, 256])



nn.AvgPool2d



kernel_size: the size of the window


stride: the stride of the


padding to be added on both sides


ceil_mode: when True, will use ceil instead of floor to compute the output shape 尺寸向上取整


count_include_pad: when True, will include the zero-padding in the averaging calculation 填充值用于计算,设置True,填充值用于计算

池化前尺寸:torch.Size([1, 3, 512, 512])
池化后尺寸:torch.Size([1, 3, 256, 256])



nn.MaxUnpool2d


反池化操作



线性层


也是全连接层



nn.Linear




激活函数


下面这个程序告诉你激活函数可以拟合任意一个非线性层。


pytorch|学习网络中的池化层,全连接层和激活函数的评论 (共 条)

分享到微博请遵守国家法律