标签:https 就是 shape border rod blog pad bsp csdn
import torch x = torch.randn(2,1,7,3) conv = torch.nn.Conv2d(1,8,(2,3)) res = conv(x) print(res.shape) # shape = (2, 8, 6, 1)
[ batch_size, channels, height_1, width_1 ]
batch_size | 一个batch中样例的个数 | 2 |
channels | 通道数,也就是当前层的深度 | 1 |
height_1 | 图片的高 | 7 |
width_1 | 图片的宽 | 3 |
[ channels, output, height_2, width_2 ]
channels | 通道数,和上面保持一致,也就是当前层的深度 | 1 |
output | 输出的深度 | 8 |
height_2 | 过滤器filter的高 | 2 |
weight_2 | 过滤器filter的宽 | 3 |
torch.nn.Conv2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True)
in_channels |
Number of channels in the input image |
out_channels |
Number of channels produced by the convolution |
kernel_size |
卷积核尺寸 |
stride |
步长,控制cross-correlation的步长,可以设为1个int型数或者一个(int, int)型的tuple。 |
padding |
(补0):控制zero-padding的数目。 |
dilation |
(扩张):控制kernel点(卷积核点)的间距 |
groups |
(卷积核个数):通常来说,卷积个数唯一,但是对某些情况,可以设置范围在1 —— in_channels中数目的卷积核: |
bias |
adds a learnable bias to the output. |
[ batch_size,output, height_3, width_3 ]
batch_size | 一个batch中样例的个数,同上 | 2 |
output | 输出的深度 | 8 |
height_3 | 卷积结果的高度 | h1-h2+1 = 7-2+1 = 6 |
weight_3 | 卷积结果的宽度 | w1-w2+1 = 3-3+1 = 1 |
参考
torch.nn.Conv2d
torch.nn.MaxPool2d
————————————————
版权声明:本文为CSDN博主「huxuedan01」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/m0_37586991/article/details/87855342
标签:https 就是 shape border rod blog pad bsp csdn
原文地址:https://www.cnblogs.com/expttt/p/12397330.html