class_docstr: SparseCumlArray abstracts sparse array allocations. This will
  accept either a Scipy or Cupy sparse array and construct CumlArrays
  out of the underlying index and data arrays. Currently, this class
  only supports the CSR array format and input in any other sparse
  format will be converted to CSR by default. Set `convert_format=False`
  to disable automatic conversion to CSR.
  
  Parameters
  ----------
  
  data : scipy.sparse.spmatrix or cupyx.scipy.sparse.spmatrix
      A Scipy or Cupy sparse matrix
  convert_to_dtype : data-type or False, optional
      Any object that can be interpreted as a numpy or cupy data type.
      Specifies whether to convert the data array to a different dtype.
  convert_index : data-type or False (default: np.int32), optional
      Any object that can be interpreted as a numpy or cupy data type.
      Specifies whether to convert the indices to a different dtype. By
      default, it is preferred to use 32-bit indexing.
  convert_format : bool, optional (default: True)
      Specifies whether to convert any non-CSR inputs to CSR. If False,
      an exception is thrown.
  
  
  Attributes
  ----------
  
  indptr : CumlArray
      Compressed row index array
  indices : CumlArray
      Column indices array
  data : CumlArray
      Data array
  dtype : dtype
      Data type of data array
  shape : tuple of ints
      Shape of the array
  nnz : int
      Number of nonzeros in underlying arrays
code: def __init__(
      self,
      data=None,
      convert_to_dtype=False,
      convert_to_mem_type=None,
      convert_index=None,
      convert_format=True,
  ):
      if not isinstance(data, SparseCumlArrayInput):
          is_sparse = False
          try:
              is_sparse = cpx_sparse.isspmatrix(data)
              from_mem_type = MemoryType.device
          except UnavailableError:
              pass
          if not is_sparse:
              try:
                  is_sparse = scipy_sparse.isspmatrix(data)
                  from_mem_type = MemoryType.host
              except UnavailableError:
                  pass
          if not is_sparse:
              raise ValueError(
                  "A sparse matrix is expected as input. "
                  "Received %s" % type(data)
              )
  
          if not isinstance(data, sparse_matrix_classes):
              if convert_format:
                  debug(
                      "Received sparse matrix in {} format but CSR is "
                      "expected. Data will be converted to CSR, but this "
                      "will require additional memory copies. If this "
                      "conversion is not desired, set "
                      "set_convert_format=False to raise an exception "
                      "instead.".format(type(data))
                  )
                  data = data.tocsr()  # currently only CSR is supported
              else:
                  raise ValueError(
                      "Expected CSR matrix but received {}".format(
                          type(data)
                      )
                  )
  
      if not convert_to_dtype:
          convert_to_dtype = data.dtype
  
      if convert_to_mem_type:
          convert_to_mem_type = MemoryType.from_str(convert_to_mem_type)
      else:
          convert_to_mem_type = GlobalSettings().memory_type
  
      if (
          convert_to_mem_type is MemoryType.mirror
          or not convert_to_mem_type
      ):
          convert_to_mem_type = from_mem_type
  
      self._mem_type = convert_to_mem_type
  
      if convert_index is None:
          convert_index = GlobalSettings().xpy.int32
      if not convert_index:
          convert_index = data.indptr.dtype
  
      # Note: Only 32-bit indexing is supported currently.
      # In CUDA11, Cusparse provides 64-bit function calls
      # but these are not yet used in RAFT/Cuml
      self.indptr = CumlArray.from_input(
          data.indptr,
          convert_to_dtype=convert_index,
          convert_to_mem_type=convert_to_mem_type,
      )
  
      self.indices = CumlArray.from_input(
          data.indices,
          convert_to_dtype=convert_index,
          convert_to_mem_type=convert_to_mem_type,
      )
  
      self.data = CumlArray.from_input(
          data.data,
          convert_to_dtype=convert_to_dtype,
          convert_to_mem_type=convert_to_mem_type,
      )
  
      self.shape = data.shape
      self.dtype = self.data.dtype
      self.nnz = data.nnz
      self.index = None
  
file_path: cuml/python/cuml/internals/array_sparse.py
imports: from cuml.internals.array import CumlArray
  from cuml.internals.global_settings import GlobalSettings
  from cuml.internals.mem_type import MemoryType
  from cuml.internals.memory_utils import class_with_cupy_rmm
  from cuml.internals.logger import debug
  from cuml.internals.safe_imports import cpu_only_import, gpu_only_import, gpu_only_import_from, null_decorator, UnavailableError
  from collections import namedtuple
label_desc: Use image node_id 1 to create a new SparseCumlArray object  with example: obj = SparseCumlArray(data, convert_to_dtype, convert_to_mem_type, convert_index, convert_format)