pytorch|學(xué)習(xí)網(wǎng)絡(luò)中的池化層,全連接層和激活函數(shù)
2022-02-23 18:26 作者:深度之眼官方賬號(hào) | 我要投稿
來源:投稿?作者:小灰灰
編輯:學(xué)姐帶你玩AI 公眾號(hào)
池化層
卷積操作中pool層是比較重要的,是提取重要信息的操作,可以去掉不重要的信息,減少計(jì)算開銷。

nn.MAXPool2d
功能是對(duì)二維信號(hào)進(jìn)行最大池化

練習(xí):
池化前尺寸: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 填充值用于計(jì)算,設(shè)置True,填充值用于計(jì)算
池化前尺寸:torch.Size([1, 3, 512, 512])
池化后尺寸:torch.Size([1, 3, 256, 256])

nn.MaxUnpool2d
反池化操作



線性層
也是全連接層

nn.Linear



激活函數(shù)
下面這個(gè)程序告訴你激活函數(shù)可以擬合任意一個(gè)非線性層。


標(biāo)簽: