Solved by JuanFMontesinos in post #5 
              
              
                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:
           …