def calc_upsampling_size(input_size: int,
                         dilation: int = 1,
                         tconv_kernel_size: int = 3,
                         tconv_stride: int = 2,
                         tconv_padding: int = 1,
                         output_padding: int = 1) -> int:
    """
    Helper function to calculate the upsampling size desired from the convolution parameters.
    This is the same formula as used by the transposed 3D convolution of PyTorch

    Args:
        - input_size (int): size of the input tensor
        - dilation (int): dilation of the convolution
        - tconv_kernel_size (int): kernel of the convolution
        - tconv_stride (int): stride of the convolution
        - tconv_padding (int): padding of the convolution
        - output_padding (int): Output padding to add
    """
    return (input_size - 1) * tconv_stride - 2 * tconv_padding + dilation * (
        tconv_kernel_size - 1) + output_padding + 1