Machine learning 错误错误匹配m1和m2,我的conv层计算的错误是什么?
我有以下体系结构:Machine learning 错误错误匹配m1和m2,我的conv层计算的错误是什么?,machine-learning,deep-learning,pytorch,Machine Learning,Deep Learning,Pytorch,我有以下体系结构: class Net(nn.Module): def __init__(self): super(Net, self).__init__() # first convolutional layer self.conv1 = torch.nn.Conv2d(1,32,5) # (32,220,220) output tensor # (W-F)/S + 1 = (224-5)/1 + 1 = 220
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
# first convolutional layer
self.conv1 = torch.nn.Conv2d(1,32,5) # (32,220,220) output tensor # (W-F)/S + 1 = (224-5)/1 + 1 = 220
# first Max-pooling layer
self.pool1 = torch.nn.MaxPool2d(2,2) # (32,110,110) output tensor
# second convolutional layer
self.conv2 = torch.nn.Conv2d(32,64,5) # (64,106,106) output tensor # (W-F)/S + 1 = (110-5)/1 + 1 = 106
# second Max-pooling layer
self.pool2 = torch.nn.MaxPool2d(2,2) # (64,53,53) output tensor
# Fully connected layer
self.fc1 = torch.nn.Linear(64*53*53, 1000)
self.fc2 = torch.nn.Linear(1000, 500)
self.fc3 = torch.nn.Linear(500, 136)
self.drop1 = nn.Dropout(p=0.4)
图像的尺寸为224x224。我得到了一个错误:
运行时错误:大小不匹配,m1:[10 x 173056],m2:[179776 x 1000]at
/opt/conda/conda bld/pytorch_1524584710464/work/aten/src/TH/generic/THTensorMath.c:2033
我看不出我的错误在哪里,有人能帮我吗?体系结构很好,我将输入图像裁剪为220 x 200维,这显然是不正确的