code: def test_diag_neg():
      ctx = F.ctx()
      val = torch.arange(3).float().to(ctx)
      D = diag(val)
      neg_D = -D
      assert D.shape == neg_D.shape
      assert torch.allclose(-D.val, neg_D.val)
      assert D.val.device == neg_D.val.device
  
imports: import sys
  import backend
  import torch
  from dgl.sparse import diag, spmatrix
label_desc: Use image node_id 2 for calling a global function with example usage: test_diag_neg() without return types