Hi Everyone,
In torch 1.2.0 - Flatten module is included.  I attached small code snippet.
import torch.nn as nn
import torch

f = nn.Flatten()
x = torch.randn((2, 2, 3))
print('Before flatten shape : ', x.shape)
print('After flatten shape : ', f(x).shape)

Thanks