code: def test_to_sparse_dask_array(input_type, nrows, ncols, client):
      from cuml.dask.common import to_sparse_dask_array
  
      c = client
  
      a = cupyx.scipy.sparse.random(
          nrows, ncols, format="csr", dtype=cp.float32
      )
      if input_type == "dask_dataframe":
          df = cudf.DataFrame(a.todense())
          inp = dask_cudf.from_cudf(df, npartitions=2)
      elif input_type == "dask_array":
          inp = dask.array.from_array(a.todense().get())
      elif input_type == "dataframe":
          inp = cudf.DataFrame(a.todense())
      elif input_type == "scipysparse":
          inp = a.get()
      elif input_type == "cupysparse":
          inp = a
      elif input_type == "numpy":
          inp = a.get().todense()
      elif input_type == "cupy":
          inp = a.todense()
  
      arr = to_sparse_dask_array(inp, c)
      arr.compute_chunk_sizes()
  
      assert arr.shape == (nrows, ncols)
  
      # We can't call compute directly on this array yet when it has
      # multiple partitions yet so we will manually concat any
      # potential pieces.
      parts = c.sync(_extract_partitions, arr)
      local_parts = cp.vstack(
          [part[1].result().todense() for part in parts]
      ).get()
  
      assert array_equal(a.todense().get(), local_parts)
  
imports: from cuml.dask.common.part_utils import _extract_partitions
  import dask
  from cuml.dask.common.dask_arr_utils import validate_dask_array
  import pytest
  from cuml.testing.utils import array_equal
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 1 for calling a global function with example usage: test_to_sparse_dask_array(input_type, nrows, ncols, client) without return types