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