RuntimeError:shape '[4, 98304]' is invalid for input of size 113216

The 113216 is flattened size of x. So the product of all of the dimensions. Can you print out the shape of x before you try and reshape it like this

x = self.pool(F.relu(self.conv2(x)))
print(x.shape)

Then just type in those dimensions instead of the ones you have.

1 Like