You could create a wrapper module like this:
class Flatten(torch.nn.Module):
    def __init__(self):
        super().__init__()

    def forward(x) 
        return x.view(x.size(0), -1) 

And pass an instance of this module to the Sequential model before the fully connected layers.