def _check_color_dim ( val ) : val = np . atleast_2d ( val ) if val . shape [ 1 ] not in ( 3 , 4 ) : raise RuntimeError ( 'Value must have second dimension of size 3 or 4' ) return val , val . shape [ 1 ]
invalid shape (3, 454, 1810) for image data python
Ensure val is Nx ( n_col ) usually Nx3
def _check_color_dim(val):
    """Ensure val is Nx(n_col), usually Nx3"""
    val = np.atleast_2d(val)
    if val.shape[1] not in (3, 4):
        raise RuntimeError('Value must have second dimension of size 3 or 4')
    return val, val.shape[1]