code: def input_to_cuml_array(
      X,
      order="F",
      deepcopy=False,
      check_dtype=False,
      convert_to_dtype=False,
      check_mem_type=False,
      convert_to_mem_type=None,
      safe_dtype_conversion=True,
      check_cols=False,
      check_rows=False,
      fail_on_order=False,
      force_contiguous=True,
  ):
      """
      Convert input X to CumlArray.
  
      Acceptable input formats:
  
      * cuDF Dataframe - returns a deep copy always.
      * cuDF Series - returns by reference or a deep copy depending on
          `deepcopy`.
      * Numpy array - returns a copy in device always
      * cuda array interface compliant array (like Cupy) - returns a
          reference unless `deepcopy`=True.
      * numba device array - returns a reference unless deepcopy=True
  
      Parameters
      ----------
  
      X : cuDF.DataFrame, cuDF.Series, NumPy array, Pandas DataFrame, Pandas
          Series or any cuda_array_interface (CAI) compliant array like CuPy,
          Numba or pytorch.
  
      order: 'F', 'C' or 'K' (default: 'F')
          Whether to return a F-major ('F'),  C-major ('C') array or Keep ('K')
          the order of X. Used to check the order of the input. If
          fail_on_order=True, the method will raise ValueError,
          otherwise it will convert X to be of order `order` if needed.
  
      deepcopy: boolean (default: False)
          Set to True to always return a deep copy of X.
  
      check_dtype: np.dtype (default: False)
          Set to a np.dtype to throw an error if X is not of dtype `check_dtype`.
  
      convert_to_dtype: np.dtype (default: False)
          Set to a dtype if you want X to be converted to that dtype if it is
          not that dtype already.
  
      safe_convert_to_dtype: bool (default: True)
          Set to True to check whether a typecasting performed when
          convert_to_dtype is True will cause information loss. This has a
          performance implication that might be significant for very fast
          methods like FIL and linear models inference.
  
      check_cols: int (default: False)
          Set to an int `i` to check that input X has `i` columns. Set to False
          (default) to not check at all.
  
      check_rows: boolean (default: False)
          Set to an int `i` to check that input X has `i` columns. Set to False
          (default) to not check at all.
  
      fail_on_order: boolean (default: False)
          Set to True if you want the method to raise a ValueError if X is not
          of order `order`.
  
      force_contiguous: boolean (default: True)
          Set to True to force CumlArray produced to be contiguous. If `X` is
          non contiguous then a contiguous copy will be done.
          If False, and `X` doesn't need to be converted and is not contiguous,
          the underlying memory underneath the CumlArray will be non contiguous.
          Only affects CAI inputs. Only affects CuPy and Numba device array
          views, all other input methods produce contiguous CumlArrays.
  
      Returns
      -------
      `cuml_array`: namedtuple('cuml_array', 'array n_rows n_cols dtype')
  
          A new CumlArray and associated data.
  
      """
      arr = CumlArray.from_input(
          X,
          order=order,
          deepcopy=deepcopy,
          check_dtype=check_dtype,
          convert_to_dtype=convert_to_dtype,
          check_mem_type=check_mem_type,
          convert_to_mem_type=convert_to_mem_type,
          safe_dtype_conversion=safe_dtype_conversion,
          check_cols=check_cols,
          check_rows=check_rows,
          fail_on_order=fail_on_order,
          force_contiguous=force_contiguous,
      )
      try:
          shape = arr.__cuda_array_interface__["shape"]
      except AttributeError:
          shape = arr.__array_interface__["shape"]
  
      n_rows = shape[0]
  
      if len(shape) > 1:
          n_cols = shape[1]
      else:
          n_cols = 1
  
      return cuml_array(
          array=arr, n_rows=n_rows, n_cols=n_cols, dtype=arr.dtype
      )
  
file_path: cuml/python/cuml/internals/input_utils.py
imports: from collections import namedtuple
  from cuml.internals.array import CumlArray
  from cuml.internals.array_sparse import SparseCumlArray
  from cuml.internals.global_settings import GlobalSettings
  from cuml.internals.mem_type import MemoryType
  from cuml.internals.safe_imports import cpu_only_import, cpu_only_import_from, gpu_only_import, gpu_only_import_from, safe_import, safe_import_from, null_decorator, return_false, UnavailableError
label_desc: Use image node_id 6 for calling a global function with example usage: input_to_cuml_array(X, order, deepcopy, check_dtype, convert_to_dtype, check_mem_type, convert_to_mem_type, safe_dtype_conversion, check_cols, check_rows, fail_on_order, force_contiguous) and returns: cuml_array