check if vector in matrix numpy code example Example: numpy check vector if weight.ndim != 1: raise ValueError("The is not a row vector.")