import math


def get_same_padding(x: int, kernel_size: int, stride: int, dilation: int) -> int:
    """Calculate asymmetric TensorFlow-like 'same' padding for a convolution.
    """
    return max((math.ceil(x / stride) - 1) * stride +
               (kernel_size - 1) * dilation + 1 - x, 0)