code: def test_has_duplicate():
      ctx = F.ctx()
  
      row = torch.tensor([1, 0, 0, 0, 1]).to(ctx)
      col = torch.tensor([1, 1, 1, 2, 2]).to(ctx)
      val = torch.arange(len(row)).to(ctx)
      shape = (4, 4)
  
      # COO
      coo_A = from_coo(row, col, val, shape)
      assert coo_A.has_duplicate()
  
      # CSR
      indptr, indices, _ = coo_A.csr()
      csr_A = from_csr(indptr, indices, val, shape)
      assert csr_A.has_duplicate()
  
      # CSC
      indptr, indices, _ = coo_A.csc()
      csc_A = from_csc(indptr, indices, val, shape)
      assert csc_A.has_duplicate()
  
imports: import unittest
  import warnings
  import backend
  import pytest
  import torch
  from dgl.sparse import diag, from_coo, from_csc, from_csr, from_torch_sparse, identity, to_torch_sparse_coo, to_torch_sparse_csc, to_torch_sparse_csr, val_like
  from .utils import rand_coo, rand_csc, rand_csr, rand_diag, sparse_matrix_to_dense
label_desc: Use image node_id 16 for calling a global function with example usage: test_has_duplicate() without return types