code: def test_relgraphconv_equality(
      idtype_int,
      max_in_degree,
      num_bases,
      regularizer,
      self_loop,
      to_block,
  ):
      device = "cuda:0"
      in_feat, out_feat, num_rels = 10, 2, 3
      args = (in_feat, out_feat, num_rels)
      kwargs = {
          "num_bases": num_bases,
          "regularizer": regularizer,
          "bias": False,
          "self_loop": self_loop,
      }
      g = generate_graph().to(device)
      g.edata[dgl.ETYPE] = torch.randint(num_rels, (g.num_edges(),)).to(
          device
      )
      if idtype_int:
          g = g.int()
      if to_block:
          g = dgl.to_block(g)
      feat = torch.rand(g.num_src_nodes(), in_feat).to(device)
  
      torch.manual_seed(0)
      conv1 = RelGraphConv(*args, **kwargs).to(device)
  
      torch.manual_seed(0)
      kwargs["apply_norm"] = False
      conv2 = CuGraphRelGraphConv(*args, **kwargs).to(device)
  
      out1 = conv1(g, feat, g.edata[dgl.ETYPE])
      out2 = conv2(
          g, feat, g.edata[dgl.ETYPE], max_in_degree=max_in_degree
      )
      assert torch.allclose(out1, out2, atol=1e-06)
  
      grad_out = torch.rand_like(out1)
      out1.backward(grad_out)
      out2.backward(grad_out)
  
      end = -1 if self_loop else None
      assert torch.allclose(
          conv1.linear_r.W.grad, conv2.W.grad[:end], atol=1e-6
      )
  
      if self_loop:
          assert torch.allclose(
              conv1.loop_weight.grad, conv2.W.grad[-1], atol=1e-6
          )
  
      if regularizer is not None:
          assert torch.allclose(
              conv1.linear_r.coeff.grad, conv2.coeff.grad, atol=1e-6
          )
  
file_path: dgl/tests/cugraph/cugraph-ops/test_cugraph_relgraphconv.py
imports: from collections import OrderedDict
  from itertools import product
  import dgl
  import pytest
  import torch
  from dgl.nn import CuGraphRelGraphConv, RelGraphConv
label_desc: Use image node_id 2 for calling a global function with example usage: test_relgraphconv_equality(idtype_int, max_in_degree, num_bases, regularizer, _loop, to_block) without return types