def crop_multiple(data, multiple_of=16):
    """Force the array dimension to be multiple of the given factor.

    Args:
        data: a >=2-dim array, first 2 dims will be cropped
        multiple_of: the factor, as an int
    Returns:
        cropped array
    """
    try:
        h, w = data.shape[0], data.shape[1]
    except AttributeError:
        # the data is not in image format, I cannot crop
        return data
    h_c, w_c = [d - (d % multiple_of) for d in [h, w]]
    if h_c != h or w_c != w:
        return data[:h_c, :w_c, ...]
    else:
        return data