参考链接

    1. import torch
    2. x = torch.randn(3,1,5,4)
    3. print(x)
    4. conv = torch.nn.Conv2d(1,4,(2,3))
    5. res = conv(x)
    6. print(res.shape) # torch.Size([3, 4, 4, 2])

    输入:x[ batch_size, channels, height_1, width_1 ]
    batch_size,一个batch中样本的个数 3
    channels,通道数,也就是当前层的深度 1
    height_1, 图片的高 5
    width_1, 图片的宽 4

    卷积操作:Conv2d[ channels, output, height_2, width_2 ]
    channels,通道数,和上面保持一致,也就是当前层的深度 1
    output,输出的深度 4【需要4个filter】
    height_2,卷积核的高 2
    width_2,卷积核的宽 3
    Conv2D产生的weight和bias
    weight:(out_channels, in_channels, ker_size, ker_size) :::tips 假定给定weight: (64, 1, 3, 3), 则反推出input:(batch_size, 1, height, width) :::

    输出:res[ batch_size,output, height_3, width_3 ]
    batch_size,,一个batch中样例的个数,同上 3
    output, 输出的深度 4
    height_3, 卷积结果的高度 4
    width_3,卷积结果的宽度 2
    image.png