def calc_same_padding(i, k, s):
    """
    Calculate same padding for convolutions
    :param i: input size (simpler for squared images)
    :param k: kernel_size
    :param s: stride
    :return: padding for 'same' padding
    """
    return round(((i - 1) * s - i + k) / 2 + 0.1)