code: def test_create_sparse_nd_from_sparse():
      def check_create_from_sp(shape, f, sp_arr, dtype, src_dtype, ctx):
          arr = f(sp_arr, dtype=dtype, ctx=ctx)
          assert same(arr.asnumpy(), np.ones(shape))
          assert arr.dtype == dtype
          assert arr.context == ctx
          # verify the default dtype inferred from dense arr
          arr2 = f(sp_arr)
          assert arr2.dtype == src_dtype
          assert arr2.context == mx.context.current_context()
  
      shape = rand_shape_2d()
      src_dtype = np.float64
      dtype = np.int32
      ctx = mx.cpu(1)
      ones = mx.nd.ones(shape, dtype=src_dtype)
      csr_arrs = [ones.tostype("csr")]
      rsp_arrs = [ones.tostype("row_sparse")]
      csr_sp = spsp.csr_matrix(np.ones(shape, dtype=src_dtype))
      csr_arrs.append(csr_sp)
      f_csr = mx.nd.sparse.csr_matrix
      f_rsp = mx.nd.sparse.row_sparse_array
      for sp_arr in csr_arrs:
          check_create_from_sp(
              shape, f_csr, sp_arr, dtype, src_dtype, ctx
          )
      for sp_arr in rsp_arrs:
          check_create_from_sp(
              shape, f_rsp, sp_arr, dtype, src_dtype, ctx
          )
  
imports: import pickle
  from mxnet.ndarray import NDArray
  import mxnet
  from mxnet.test_utils import *
  from common import random_seed
  from mxnet.base import mx_real_t
  from numpy.testing import assert_allclose
  import numpy.random
  import numpy
  import scipy.sparse
  from common import assertRaises, xfail_when_nonstandard_decimal_separator
  from mxnet.ndarray.sparse import RowSparseNDArray, CSRNDArray
  import pytest
label_desc: Use image node_id 32 for calling a global function with example usage: test_create_sparse_nd_from_sparse() without return types