Wrapping submodules into nn.Sequential containers often fails, as you might be missing functional API calls used in the forward method.
In your case, this torch.flatten operation is missing and will yield the shape mismatch.
You could either add it as an nn.Flatten to your nn.Sequential model or derive a custom class and override the forward method.