mat1 dim 1 must match mat2 dim 0 -Pytorch
I have attempted to solve this error but it has been to no avail. My CNN model is below:
The shape of X_train and X_test are:
X_train shape: torch.Size([12271, 3, 100, 100]) | X_test shape: torch.Size([3068, 3, 100, 100])
class Net(nn.Module):
    def __init__(self, num_classes=7):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size= 5,stride=1,padding=2)
        self.conv2 = nn.Conv2d(in_channels=32, out_channels=64, kernel_size=5,stride=1,padding=2)
        self.conv3 = nn.Conv2d(in_channels=64, out_channels=128, kernel_size=5,stride=1,padding=2)
        
        self.pool = nn.MaxPool2d(2, 2)
        self.drop = nn.Dropout2d(p=0.2)

        self.fc1 = nn.Linear(9216, 1000)
        self.fc2 = nn.Linear(1000, 500)
        self.fc3 = nn.Linear(500, out_features=num_classes)

    def forward(self, x):
        x = self.pool(F.relu(self.conv1(x)))
        x = self.pool(F.relu(self.conv2(x)))
        x = self.pool(F.relu(self.conv3(x)))

        x = x.reshape(x.size(0), -1)

        x = F.dropout(self.drop(x), training=self.training)

        x = F.relu(self.fc1(x))
        x = F.relu(self.fc2(x))
        x = self.fc3(x)
        return x


net = Net()

print(net)

The training on the model on data code as required is show below:
The required traceback is below:
count = 0
total_step = len(trainloader)
loss_list = []
acc_list = []
iteration_list = []
for epoch in range(20):
    for i, data  in enumerate(trainloader,0):
      images, labels = data[0].to(device), data[1].to(device)
        # Run the forward pass
      outputs = net(images.float())
      loss = criterion(outputs, labels)
      loss_list.append(loss.item())
      iteration_list.append(i)
      # Backprop and perform Adam optimisation
      optimizer.zero_grad()
      loss.backward()
      optimizer.step()

      #count += 1
      
      #if count % 100 == 0:
        # Track the accuracy
      total = labels.size(0)
      _, predicted = torch.max(outputs.data, 1)
      correct = (predicted == labels).sum().item()
      acc_list.append(correct / total)

      if (i + 1) % 1000 == 0:
          print('Epoch [{}/{}], Step [{}/{}], Loss: {:.4f}, Accuracy: {:.2f}%'
                .format(epoch + 1, num_epochs, i + 1, total_step, loss.item(),
                        (correct / total) * 100))


Your final convolution's (conv3) output dimensions don't match the input dimension of first Linear layer. self.conv3's output shape will be BatchSize x 128 x 12 x 12 when resized:
x = x.reshape(x.size(0), -1)
print(x.shape)  # torch.Size([BS, 18432])

So 18432 doesn't match 9216. You can do one of these changes and it will match the dimension and work:
# Reduce output channels here
self.conv3 = nn.Conv2d(in_channels=64, out_channels=64, kernel_size=5,stride=1,padding=2)
# OR change input dimension of Linear layer
self.fc1 = nn.Linear(18432, 1000)

Just a side note, you don't need to use a functional dropout in forward pass, you have already created a callable dropout in init. You can just call that:
x = self.drop(x)    # Instead of x = F.dropout(self.drop(x), training=self.training)

Training/testing mode for the dropout is handled internally when you switch between modes  net.eval() or net.train(). So you don't need to worry about that.
