class Conv2DExt(nn.Module):
    def __init__(self,*args,**kwargs):
        super().__init__(self)
        self.conv2d = nn.ConvTranspose2d(*args,**kwargs)
    def forward(self, input, output_size=None):  # type: (Tensor, Optional[List[int]]) -> Tensor
        if input.ndimensions() == 5:
            B, F, C, H, W = input.shape
            input = input.view(-1, C, H, W)
        return self.conv2d(input, output_size=output_size)

nn.Sequential(
            nn.Linear(in_features, out_features)
            UnFlatten(), # reshape the output of previous layers so that its input shape to the next layers is proper
            nn.Conv2DExt()
            nn.ReLU(),
            nn.ConvTranspose2d()
            nn.ReLU(),
            nn.ConvTranspose2d()
            nn.ReLU(),
            nn.ConvTranspose2d()
            nn.Sigmoid(),
        )
# You have to reshape in the forward after this module.