code: def test_gatconv_equality(
      idtype_int, max_in_degree, num_heads, to_block
  ):
      device = "cuda:0"
      in_feat, out_feat = 10, 2
      args = (in_feat, out_feat, num_heads)
      kwargs = {"bias": False}
      g = generate_graph().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 = GATConv(*args, **kwargs, allow_zero_in_degree=True).to(
          device
      )
      out1 = conv1(g, feat)
  
      torch.manual_seed(0)
      conv2 = CuGraphGATConv(*args, **kwargs).to(device)
      dim = num_heads * out_feat
      with torch.no_grad():
          conv2.attn_weights.data[:dim] = conv1.attn_l.data.flatten()
          conv2.attn_weights.data[dim:] = conv1.attn_r.data.flatten()
          conv2.fc.weight.data[:] = conv1.fc.weight.data
      out2 = conv2(g, feat, max_in_degree=max_in_degree)
      assert torch.allclose(out1, out2, atol=1e-6)
  
      grad_out1 = torch.rand_like(out1)
      grad_out2 = grad_out1.clone().detach()
      out1.backward(grad_out1)
      out2.backward(grad_out2)
  
      assert torch.allclose(
          conv1.fc.weight.grad, conv2.fc.weight.grad, atol=1e-6
      )
      assert torch.allclose(
          torch.cat((conv1.attn_l.grad, conv1.attn_r.grad), dim=0),
          conv2.attn_weights.grad.view(2, num_heads, out_feat),
          atol=1e-6,
      )
  
file_path: dgl/tests/cugraph/cugraph-ops/test_cugraph_gatconv.py
imports: from collections import OrderedDict
  from itertools import product
  import dgl
  import pytest
  import torch
  from dgl.nn import CuGraphGATConv, GATConv
label_desc: Use image node_id 2 for calling a global function with example usage: test_gatconv_equality(idtype_int, max_in_degree, num_heads, to_block) without return types