code: def rand_coo_uncoalesced(shape, nnz, dev):
      # Create a sparse matrix with possible duplicate entries.
      row = torch.randint(shape[0], (nnz,), device=dev)
      col = torch.randint(shape[1], (nnz,), device=dev)
      val = torch.randn(nnz, device=dev, requires_grad=True)
      indices = torch.stack([row, col])
      indices = rand_stride(indices)
      return spmatrix(indices, val, shape)
  
file_path: dgl/tests/python/pytorch/sparse/utils.py
imports: import numpy
  import torch
  from dgl.sparse import diag, from_csc, from_csr, SparseMatrix, spmatrix
label_desc: Use image node_id 7 for calling a global function with example usage: rand_coo_uncoalesced(shape, nnz, dev) and returns: spmatrix