首页 > 其他 > 详细

torch.nn.Conv2d()使用

时间:2020-02-28 15:54:00      阅读:299      评论:0      收藏:0      [点我收藏+]

API

技术分享图片

输入:[ batch_size, channels, height_1, width_1 ]

Conv2d输入参数:[ channels, output, height_2, width_2 ]

输出:[ batch_size,output, height_3, width_3 ]

 

实例:

def torch_practice():
    x = torch.randn(2,1,16,4)
    conv = torch.nn.Conv2d(1, 32, (2,2))
    res = conv(x)
    print(res.shape)


if __name__ == __main__:
    torch_practice()

输出:torch.Size([2, 32, 15, 3])

batch大小不变:2

输出通道加厚:32。由卷积核的通道数决定

卷积结果:[15,3]。计算公式,n-m+1, 16-2+1=15

 

torch.nn.Conv2d()使用

原文:https://www.cnblogs.com/demo-deng/p/12376866.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!