code: def verify_dense_sw(
      batch, in_dim, out_dim, use_bias=True, dtype="float32"
  ):
      nonzeros = te.var("nonzeros")
      A = te.placeholder((batch, in_dim), dtype=dtype, name="A")
      B = tvmsp.placeholder(
          shape=(out_dim, in_dim),
          nonzeros=nonzeros,
          dtype=dtype,
          name="B",
      )
      C = te.placeholder((out_dim,), dtype=dtype, name="C")
      D = topi.sparse.dense(A, B, C if use_bias else None)
      s = te.create_schedule(D.op)
  
      # get the test data
      def get_ref_data():
          mag = 10.0
          a_np = (
              mag
              * (
                  np.random.uniform(size=(batch, in_dim)).astype(
                      "float32"
                  )
                  - 0.5
              )
          ).astype(dtype)
          b_np = np.maximum(
              mag
              * (
                  np.random.uniform(size=(out_dim, in_dim)).astype(
                      "float32"
                  )
                  - 0.5
              ),
              0.0,
          ).astype(dtype)
          c_np = (
              mag
              * (
                  np.random.uniform(size=(out_dim,)).astype("float32")
                  - 0.5
              )
          ).astype(dtype)
          if use_bias:
              d_np = np.dot(a_np, b_np.T) + c_np
          else:
              d_np = np.dot(a_np, b_np.T)
          return (a_np, b_np, c_np, d_np)
  
      a_np, b_np, c_np, d_np = get_ref_data()
  
      def check_device(device):
          dev = tvm.device(device, 0)
          if not tvm.testing.device_enabled(device):
              print("Skip because %s is not enabled" % device)
              return
          print("Running on target: %s" % device)
          a = tvm.nd.array(a_np, dev)
          b = tvmsp.array(b_np, dev)
          c = tvm.nd.array(c_np, dev)
          d = tvm.nd.array(
              np.zeros(get_const_tuple(D.shape), dtype=dtype), dev
          )
          f = tvm.build(
              s,
              [A, B.data, B.indices, B.indptr, C, D],
              device,
              name="dense",
          )
          f(a, b.data, b.indices, b.indptr, c, d)
          tvm.testing.assert_allclose(
              d.numpy(), d_np, rtol=1e-4, atol=1e-4
          )
  
      check_device("llvm")
  
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 4 for calling a global function with example usage: verify_dense_sw(batch, in_dim, out_dim, use_bias, dtype) and returns: a_np,  b_np,  c_np,  d_np