In this case we would prefer to write the module with a class, and let nn.Sequential only for very simple functions.
But if you definitely want to flatten your result inside a Sequential, you could define a module such as
class Flatten(nn.Module):
    def forward(self, input):
        return input.view(input.size(0), -1)

and use Flatten in your model