code: def test_create_sparse_execution(setup):
      mat = sps.csr_matrix([[0, 0, 2], [2, 0, 0]])
      t = tensor(mat, dtype="f8", chunk_size=2)
  
      res = t.execute().fetch()
      assert isinstance(res, SparseNDArray)
      assert res.dtype == np.float64
      np.testing.assert_array_equal(res.toarray(), mat.toarray())
  
      t2 = ones_like(t, dtype="f4")
  
      res = t2.execute().fetch()
      expected = sps.csr_matrix([[0, 0, 1], [1, 0, 0]])
      assert isinstance(res, SparseNDArray)
      assert res.dtype == np.float32
      np.testing.assert_array_equal(res.toarray(), expected.toarray())
  
      t3 = tensor(
          np.array([[0, 0, 2], [2, 0, 0]]), chunk_size=2
      ).tosparse()
  
      res = t3.execute().fetch()
      assert isinstance(res, SparseNDArray)
      assert res.dtype == np.int_
      np.testing.assert_array_equal(res.toarray(), mat.toarray())
  
      # test missing argument
      t4 = tensor(
          np.array([[0, 0, 2], [2, 0, 0]]), chunk_size=2
      ).tosparse(missing=2)
      t4 = t4 + 1
      expected = mat.toarray()
      raw = expected.copy()
      expected[raw == 0] += 1
      expected[raw != 0] = 0
  
      res = t4.execute().fetch()
      assert isinstance(res, SparseNDArray)
      assert res.dtype == np.int_
      np.testing.assert_array_equal(res.toarray(), expected)
  
      # test missing argument that is np.nan
      t5 = tensor(
          np.array([[np.nan, np.nan, 2], [2, np.nan, -999]]),
          chunk_size=2,
      ).tosparse(missing=[np.nan, -999])
      t5 = (t5 + 1).todense(fill_value=np.nan)
      expected = mat.toarray().astype(float)
      expected[expected != 0] += 1
      expected[expected == 0] = np.nan
  
      res = t5.execute().fetch()
      assert res.dtype == np.float64
      np.testing.assert_array_equal(res, expected)
  
imports: import tempfile
  import shutil
  import os
  import time
  import numpy
  import pandas
  import pytest
  from ....None import tensor
  from ....None import dataframe
  from ....lib.sparse import SparseNDArray
  from ....tests.core import require_cupy
  from ....utils import lazy_import
  from ...lib import nd_grid
  from ..None import tensor, ones_like, zeros, zeros_like, full, full_like, arange, empty, empty_like, diag, diagflat, eye, linspace, meshgrid, indices, triu, tril, from_dataframe, fromtiledb, fromhdf5, fromzarr
label_desc: Use image node_id 2 for calling a global function with example usage: test_create_sparse_execution(setup) without return types