@staticmethod
def check_pad_value_by_mode(op_name, pad_mode, padding):
    """Validate value of padding according to pad_mode"""
    if pad_mode != 'pad' and padding != 0:
        raise ValueError(
            f"For op '{op_name}', padding must be zero when pad_mode is '{pad_mode}'."
            )
    return padding
