code: def test_spspmm_duplicate():
      dev = F.ctx()
  
      row = torch.tensor([1, 0, 0, 0, 1]).to(dev)
      col = torch.tensor([1, 1, 1, 2, 2]).to(dev)
      val = torch.randn(len(row)).to(dev)
      shape = (4, 4)
      A1 = from_coo(row, col, val, shape)
  
      row = torch.tensor([1, 0, 0, 1]).to(dev)
      col = torch.tensor([1, 1, 2, 2]).to(dev)
      val = torch.randn(len(row)).to(dev)
      shape = (4, 4)
      A2 = from_coo(row, col, val, shape)
  
      try:
          matmul(A1, A2)
      except:
          pass
      else:
          assert False, "Should raise error."
  
      try:
          matmul(A2, A1)
      except:
          pass
      else:
          assert False, "Should raise error."
  
file_path: dgl/tests/python/pytorch/sparse/test_matmul.py
imports: import warnings
  import backend
  import pytest
  import torch
  from dgl.sparse import bspmm, diag, from_coo, val_like
  from dgl.sparse.matmul import matmul
  from .utils import clone_detach_and_grad, dense_mask, rand_coo, rand_csc, rand_csr, rand_stride, sparse_matrix_to_dense, sparse_matrix_to_torch_sparse
label_desc: Use image node_id 5 for calling a global function with example usage: test_spspmm_duplicate() without return types