code: def assert_all_finite(X):
      """Throw a ValueError if X contains NaN or infinity.
      Parameters
      ----------
      X : array or sparse matrix
      """
      _assert_all_finite(X.data if sp.issparse(X) else X)
  
imports: import warnings
  import numbers
  import numpy
  import scipy.sparse
  from ..None import six
  from ...utils.exceptions import NotFittedError, NonBLASDotWarning, DataConversionWarning
label_desc: Use image node_id 2 for calling a global function with example usage: assert_all_finite(X) without return types