def forward(self, x):
x = F.relu(F.max_pool2d(self.conv1(x), 2))
x = F.relu(F.max_pool2d(self.conv2_drop(self.conv2(x)), 2))
x = x.view(x.size(0), -1)
x = F.relu(self.fc1(x))
x = F.dropout(x, training=self.training)
x = self.fc2(x)
return x
Error:
RuntimeError: mat1 and mat2 shapes cannot be multiplied (25x1615440 and 720x1024)
The error is occurring because the output of your convolutions and max pooling do not match the input size of your fc1 Linear layer. A print statement should show this. Either you should run an adaptive pooling layer to reduce the size of the convolution outputs to 6x6, or you can increase the size of your Linear layer input to 1615440.