def _assert_all_finite(X):
X = np.asanyarray(X)<EOL>if (X.dtype.char in np.typecodes['<STR_LIT>'] and not np.isfinite(X.sum())<EOL>and not np.isfinite(X).all()):<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>" % X.dtype)<EOL><DEDENT>
Like assert_all_finite, but only for ndarray.