def get_padding_value(padding: str, kernel_size: int, **kwargs) -> Tuple[int, bool]:
    """
    Args:
        padding(`Str`):
            Padding type, 'same' or 'valid'.
        kernel_size(`Int`):
            Convolution kernel size.
    Returns:
        (`Int`): padding shape.
        (`Bool`): dynamically padding.
    """
    dynamic = False
    if isinstance(padding, str):
        # for any string padding, the padding will be calculated for you, one of three ways
        padding = padding.lower()
        if padding == 'same':
            # TF compatible 'SAME' padding, has a performance and GPU memory allocation impact
            if is_static_pad(kernel_size, **kwargs):
                # static case, no extra overhead
                padding = get_padding(kernel_size, **kwargs)
            else:
                # dynamic 'SAME' padding, has runtime/GPU memory overhead
                padding = 0
                dynamic = True
        elif padding == 'valid':
            # 'VALID' padding, same as padding=0
            padding = 0
        else:
            # Default to PyTorch style 'same'-ish symmetric padding
            padding = get_padding(kernel_size, **kwargs)
    return padding, dynamic
Args:
padding(`Str`):
Padding type, 'same' or 'valid'.
kernel_size(`Int`):
Convolution kernel size.
Returns:
(`Int`): padding shape.
(`Bool`): dynamically padding.
towhee/models/layers/padding_functions.py