code: def _assert_all_finite(X: np.ndarray):
      """Throw a ValueError if X contains NaN or Infinity.
  
      Based on Sklearn method to handle NaN & Infinity.
          @inproceedings{sklearn_api,
          author    = {Lars Buitinck and Gilles Louppe and Mathieu Blondel and
                      Fabian Pedregosa and Andreas Mueller and Olivier Grisel and
                      Vlad Niculae and Peter Prettenhofer and Alexandre Gramfort
                      and Jaques Grobler and Robert Layton and Jake VanderPlas and
                      Arnaud Joly and Brian Holt and Ga{\"{e}}l Varoquaux},
          title     = {{API} design for machine learning software: experiences from the scikit-learn
                      project},
          booktitle = {ECML PKDD Workshop: Languages for Data Mining and Machine Learning},
          year      = {2013},
          pages = {108--122},
          }
  
      Args:
          X: Array to validate
  
      Raises:
          ValueError: If X contains NaN or Infinity
      """
  
      if not np.isfinite(X).all():
          raise ValueError(
              f"Input contains NaN, infinity or a value too large for {X.dtype}."
          )
  
file_path: causalnex/causalnex/structure/notears.py
imports: import logging
  import warnings
  from copy import deepcopy
  from typing import List, Tuple
  import numpy
  import pandas
  import scipy.linalg
  import scipy.optimize
  from causalnex.structure.structuremodel import StructureModel
label_desc: Use image node_id 7 for calling a global function with example usage: _assert_all_finite(X) without return types