code: def test_sparse_transpose_csr():
      N, density = 1023, 0.3
  
      X_sp = sp.random(
          N, N, density=density, format="csr", dtype="float32"
      )
  
      X_sp_T = X_sp.transpose()
      X_np_T = X_sp_T.todense()
  
      X_data = te.placeholder(
          shape=X_sp.data.shape, dtype=str(X_sp.data.dtype)
      )
      X_indices = te.placeholder(
          shape=X_sp.indices.shape, dtype=str(X_sp.indices.dtype)
      )
      X_indptr = te.placeholder(
          shape=X_sp.indptr.shape, dtype=str(X_sp.indptr.dtype)
      )
  
      X_T_data, X_T_indices, X_T_indptr = topi.nn.sparse_transpose(
          X_data, X_indices, X_indptr
      )
      s = te.create_schedule(
          [X_T_data.op, X_T_indices.op, X_T_indptr.op]
      )
      func = tvm.build(
          s,
          [
              X_data,
              X_indices,
              X_indptr,
              X_T_data,
              X_T_indices,
              X_T_indptr,
          ],
      )
  
      X_T_data_tvm = tvm.nd.array(
          np.zeros(X_sp_T.data.shape, dtype=X_sp_T.data.dtype)
      )
      X_T_indices_tvm = tvm.nd.array(
          np.zeros(X_sp_T.indices.shape, dtype=X_sp_T.indices.dtype)
      )
      X_T_indptr_tvm = tvm.nd.array(
          np.zeros(X_sp_T.indptr.shape, dtype=X_sp_T.indptr.dtype)
      )
  
      func(
          tvm.nd.array(X_sp.data),
          tvm.nd.array(X_sp.indices),
          tvm.nd.array(X_sp.indptr),
          X_T_data_tvm,
          X_T_indices_tvm,
          X_T_indptr_tvm,
      )
  
      X_T_out = sp.csr_matrix(
          (
              X_T_data_tvm.numpy(),
              X_T_indices_tvm.numpy(),
              X_T_indptr_tvm.numpy(),
          ),
          shape=(N, N),
      ).todense()
      tvm.testing.assert_allclose(X_np_T, X_T_out, atol=1e-4, rtol=1e-4)
  
imports: import numpy
  import tvm
  from tvm import te
  from tvm import topi
  from tvm import relay
  import tvm.topi.testing
  from tvm.topi.utils import get_const_tuple
  import tvm.contrib.sparse
  from collections import namedtuple
  import time
  import scipy.sparse
  import tvm.testing
label_desc: Use image node_id 12 for calling a global function with example usage: test_sparse_transpose_csr() without return types