def out_tconv(spatial, config):
    """
    Calculate spatial output shape after transpose convolution. 
    Arguments:
        spatial (tensor): spatial dimensions.
        config (dict): module parameters.
    """
    p, k, s = [config[k] 
            for k in ['padding', 'kernel_size', 'stride']]
    p2 = p if isinstance(p, int) else p[0] + p[1]
    p_out = config.get('output_padding', 0)
    return (spatial-1)*s - p2 + k + p_out