code: def check_input(
      input_data,
      y=None,
      preprocessor=None,
      type_of_inputs="classic",
      tuple_size=None,
      accept_sparse=False,
      dtype="numeric",
      order=None,
      copy=False,
      force_all_finite=True,
      multi_output=False,
      ensure_min_samples=1,
      ensure_min_features=1,
      y_numeric=False,
      estimator=None,
  ):
      """Checks that the input format is valid, and converts it if specified
      (this is the equivalent of scikit-learn's `check_array` or `check_X_y`).
      All arguments following tuple_size are scikit-learn's `check_X_y`
      arguments that will be enforced on the data and labels array. If
      indicators are given as an input data array, the returned data array
      will be the formed points/tuples, using the given preprocessor.
  
      Parameters
      ----------
      input : array-like
        The input data array to check.
  
      y : array-like
        The input labels array to check.
  
      preprocessor : callable (default=`None`)
        The preprocessor to use. If None, no preprocessor is used.
  
      type_of_inputs : `str` {'classic', 'tuples'}
        The type of inputs to check. If 'classic', the input should be
        a 2D array-like of points or a 1D array like of indicators of points. If
        'tuples', the input should be a 3D array-like of tuples or a 2D
        array-like of indicators of tuples.
  
      accept_sparse : `bool`
        Set to true to allow sparse inputs (only works for sparse inputs with
        dim < 3).
  
      tuple_size : int
        The number of elements in a tuple (e.g. 2 for pairs).
  
      dtype : string, type, list of types or None (default='numeric')
        Data type of result. If None, the dtype of the input is preserved.
        If 'numeric', dtype is preserved unless array.dtype is object.
        If dtype is a list of types, conversion on the first type is only
        performed if the dtype of the input is not in the list.
  
      order : 'F', 'C' or None (default=`None`)
        Whether an array will be forced to be fortran or c-style.
  
      copy : boolean (default=False)
        Whether a forced copy will be triggered. If copy=False, a copy might
        be triggered by a conversion.
  
      force_all_finite : boolean or 'allow-nan', (default=True)
        Whether to raise an error on np.inf and np.nan in X. This parameter
        does not influence whether y can have np.inf or np.nan values.
        The possibilities are:
         - True: Force all values of X to be finite.
         - False: accept both np.inf and np.nan in X.
         - 'allow-nan':  accept  only  np.nan  values in  X.  Values  cannot  be
           infinite.
  
      ensure_min_samples : int (default=1)
        Make sure that X has a minimum number of samples in its first
        axis (rows for a 2D array).
  
      ensure_min_features : int (default=1)
        Make sure that the 2D array has some minimum number of features
        (columns). The default value of 1 rejects empty datasets.
        This check is only enforced when X has effectively 2 dimensions or
        is originally 1D and ``ensure_2d`` is True. Setting to 0 disables
        this check.
  
      estimator : str or estimator instance (default=`None`)
        If passed, include the name of the estimator in warning messages.
  
      Returns
      -------
      X : `numpy.ndarray`
        The checked input data array.
  
      y: `numpy.ndarray` (optional)
        The checked input labels array.
      """
  
      context = make_context(estimator)
  
      args_for_sk_checks = dict(
          accept_sparse=accept_sparse,
          dtype=dtype,
          order=order,
          copy=copy,
          force_all_finite=force_all_finite,
          ensure_min_samples=ensure_min_samples,
          ensure_min_features=ensure_min_features,
          estimator=estimator,
      )
  
      # We need to convert input_data into a numpy.ndarray if possible, before
      # any further checks or conversions, and deal with y if needed. Therefore
      # we use check_array/check_X_y with fixed permissive arguments.
      if y is None:
          input_data = check_array(
              input_data,
              ensure_2d=False,
              allow_nd=True,
              copy=False,
              force_all_finite=False,
              accept_sparse=True,
              dtype=None,
              ensure_min_features=0,
              ensure_min_samples=0,
          )
      else:
          input_data, y = check_X_y(
              input_data,
              y,
              ensure_2d=False,
              allow_nd=True,
              copy=False,
              force_all_finite=False,
              accept_sparse=True,
              dtype=None,
              ensure_min_features=0,
              ensure_min_samples=0,
              multi_output=multi_output,
              y_numeric=y_numeric,
          )
  
      if type_of_inputs == "classic":
          input_data = check_input_classic(
              input_data, context, preprocessor, args_for_sk_checks
          )
  
      elif type_of_inputs == "tuples":
          input_data = check_input_tuples(
              input_data,
              context,
              preprocessor,
              args_for_sk_checks,
              tuple_size,
          )
  
          # if we have y and the input data are pairs, we need to ensure
          # the labels are in [-1, 1]:
          if y is not None and input_data.shape[1] == 2:
              check_y_valid_values_for_pairs(y)
  
      else:
          raise ValueError(
              "Unknown value {} for type_of_inputs. Valid values are "
              "'classic' or 'tuples'.".format(type_of_inputs)
          )
  
      return input_data if y is None else (input_data, y)
  
imports: import numpy
  from numpy.linalg import LinAlgError
  from sklearn.datasets import make_spd_matrix
  from sklearn.decomposition import PCA
  from sklearn.utils import check_array
  from sklearn.utils.validation import check_X_y, check_random_state
  from .exceptions import PreprocessorError, NonPSDError
  from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
  from scipy.linalg import pinvh, eigh
  import sys
  import time
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: check_input(input_data, y, preprocessor, type_of_inputs, tuple_size, accept_sparse, dtype, order, copy, force_all_finite, multi_output, ensure_min_samples, ensure_min_features, y_numeric, estimator) and returns: unknown