code: def random_sparse_dense_params(func, params, bs_r, bs_c, density):
      """Replace the dense parameters with random sparse parameters. Mainly used for testing.
  
      Parameters
      ----------
      func : tvm.relay.Expr
          Expr will be optimized to sparse operation.
      params : Dict[Srting, tvm.nd.array]
          Parameters of the Expr.
      bs_r : int
          The row of BSR matrix block.
      bs_c : int
          The column of BSR matrix block.
      density : float
          The density of the random sparse parameters.
  
      Returns
      -------
      Dict[Srting, tvm.nd.array]
          The generated random parameters.
      """
  
      def deepcopy(param_dic):
          ret = {}
          for k, v in param_dic.items():
              ret[k] = tvm.nd.array(v.numpy())
          return ret
  
      new_params = deepcopy(params)
      dense_weight_names = (
          relay.analysis.sparse_dense._search_dense_op_weight(func)
      )
      for item in dense_weight_names:
          name = str(item)
          shape = new_params[name].shape
          if shape[0] % bs_r == 0 and shape[1] % bs_c == 0:
              new_w = random_bsr_matrix(
                  shape[0], shape[1], bs_r, bs_c, density, "float32"
              ).todense()
              new_params[name] = tvm.nd.array(new_w)
      return new_params
  
file_path: tvm/python/tvm/topi/sparse/utils.py
imports: import tvm
  from tvm import relay, auto_scheduler
  from tvm.relay import data_dep_optimization
  from tvm.auto_scheduler import _ffi_api
label_desc: Use image node_id 2 for calling a global function with example usage: random_sparse_dense_params(func, params, bs_r, bs_c, density) and returns: new_params, ret