code: def gen_sparse(size, density, dtype, device="cpu"):
      sparse_dim = len(size)
      nnz = int(size[0] * size[1] * density)
      indices, values = generate_coo_data(
          size, sparse_dim, nnz, dtype, device
      )
      return torch.sparse_coo_tensor(
          indices, values, size, dtype=dtype, device=device
      )
  
file_path: pytorch/torch/utils/benchmark/examples/sparse/compare.py
imports: import pickle
  import sys
  import time
  import torch
  import torch.utils.benchmark
label_desc: Use image node_id 2 for calling a global function with example usage: gen_sparse(size, density, dtype, device) and returns: torch