Hi, I’m just getting started with the pytorch.Preformatted text
In this example, I don’t understand why the input of the full connected layer is the output latitude of the previous convolution multiplied by the size of the convolution kernel?
This is my code
class net(nn.Module):
def __init__(self):
super(net,self).__init__()
self.cov1 = nn.Conv2d(1,6,5)#1表示图像为单通道 6表示输出的时候是6个通道 5表示卷积核5*5
self.cov2 = nn.Conv2d(6,16,5)
#接下来是仿射层/全连接层
#nn.Linear的第一个参数取决于上一层的输出,上一个Cov2d输出纬度是16,然后还要乘以卷积核的长和宽
self.fc1 = nn.Linear(16*5*5,120)
self.fc2 = nn.Linear(120,81)
self.fc3 = nn.Linear(81,10)