Thanks for the hint! You are absolutely right.
You are re-creating the model as a nn.Sequential module, so that the view you are probably using in forward will be missing.
You can fix using a Flatten module between your layers. Here is a small example:
class Flatten(nn.Module):
    def __init__(self):
        super(Flatten, self).__init__()
        
    def forward(self, x):
        return x.view(x.size(0), -1)


class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
        self.conv1 = nn.Conv2d(3, 6, 3, 1, 1)
        self.fc1 = nn.Linear(6*24*24, 10)
        self.fc2 = nn.Linear(10, 2)
        
    def forward(self, x):
        x = F.relu(self.conv1(x))
        x = x.view(x.size(0), -1)
        x = F.relu(self.fc1(x))
        x = self.fc2(x)
        return x

    
model = MyModel()
x = torch.randn(1, 3, 24, 24)
output = model(x)

layers = list(model.children())[:1] + [Flatten()] + list(model.children())[1:]
model = nn.Sequential(*layers)
output = model(x)