code: def test_addsub_diag(val_shape, opname):
      op = getattr(operator, opname)
      func = getattr(dglsp, opname)
      ctx = F.ctx()
      shape = (3, 4)
      val_shape = (shape[0],) + val_shape
      D1 = dglsp.diag(torch.randn(val_shape).to(ctx), shape=shape)
      D2 = dglsp.diag(torch.randn(val_shape).to(ctx), shape=shape)
  
      C1 = op(D1, D2).to_dense()
      C2 = func(D1, D2).to_dense()
      dense_C = op(D1.to_dense(), D2.to_dense())
  
      assert torch.allclose(dense_C, C1)
      assert torch.allclose(dense_C, C2)
  
      with pytest.raises(TypeError):
          op(D1, 2)
      with pytest.raises(TypeError):
          op(2, D1)
  
file_path: dgl/tests/python/pytorch/sparse/test_elementwise_op.py
imports: import operator
  import backend
  import dgl.sparse
  import pytest
  import torch
  from dgl.sparse import diag, power
label_desc: Use image node_id 6 for calling a global function with example usage: test_addsub_diag(val_shape, opname) without return types