def assert_all_finite(X):
<EOL>_assert_all_finite(X.data if sp.issparse(X) else X)<EOL>
Throw a ValueError if X contains NaN or infinity.

    Input MUST be an np.ndarray instance or a scipy.sparse matrix.