code: def assert_all_finite(
      X,
      *,
      allow_nan=False,
      estimator_name=None,
      input_name="",
  ):
      """Throw a ValueError if X contains NaN or infinity.
  
      Parameters
      ----------
      X : {ndarray, sparse matrix}
          The input data.
  
      allow_nan : bool, default=False
          If True, do not throw error when `X` contains NaN.
  
      estimator_name : str, default=None
          The estimator name, used to construct the error message.
  
      input_name : str, default=""
          The data name used to construct the error message. In particular
          if `input_name` is "X" and the data has NaN values and
          allow_nan is False, the error message will link to the imputer
          documentation.
      """
      _assert_all_finite(
          X.data if sp.issparse(X) else X,
          allow_nan=allow_nan,
          estimator_name=estimator_name,
          input_name=input_name,
      )
  
imports: import numbers
  import operator
  import warnings
  from contextlib import suppress
  from functools import reduce, wraps
  from inspect import Parameter, isclass, signature
  import joblib
  import numpy
  import scipy.sparse
  from ..None import get_config
  from ..exceptions import DataConversionWarning, NotFittedError, PositiveSpectrumWarning
  from ..utils._array_api import _asarray_with_order, _is_numpy_namespace, get_namespace
  from ..utils.fixes import ComplexWarning
  from ._isfinite import FiniteStatus, cy_isfinite
  from .fixes import _object_dtype_isnan
label_desc: Use image node_id 4 for calling a global function with example usage: assert_all_finite(X) without return types