Hi Luke!



 luke0:

mat1 and mat2 shapes cannot be multiplied (12x403328 and 1266750x120)
All my image inputs are 750x563 jpgs.


By the time you get to fc1 – where the error is occurring – your images
are no longer of the same size as when passed into forward().


    class NeuralNetwork(nn.Module):
        def __init__(self):
            super().__init__()
            self.conv1 = nn.Conv2d(3, 6, 5)



Conv2d changes (reduces) the size of your image.


            self.pool = nn.MaxPool2d(2, 2)



MaxPool2d also reduces the size of your image.


        def forward(self, x):
            x = self.pool(F.relu(self.conv1(x)))
            x = self.pool(F.relu(self.conv2(x)))
            x = torch.flatten(x, 1) # flatten all dimensions except batch
            x = F.relu(self.fc1(x))
            ....



In forward(), print out the shape of x (initially your input image), first
at the beginning,  after the application of conv1(), after the first application
of pool(), after conv2(), after the second pool(), and then again after
flatten().  You will see the height and width of x shrinking.  The shape
of x after flatten will tell you the number in_features you need for fc1
and it will (presumably) be 403328 rather than 1266750.
Best.
K. Frank