code: def test_copy_u_hetero(idtype, feat_size):
      ctx = F.ctx()
      hg = dgl.heterograph(
          {
              ("user", "follow", "user"): ([0, 1, 2], [2, 3, 4]),
              ("user", "like", "movie"): ([3, 3, 1, 2], [0, 0, 1, 1]),
          }
      )
  
      hg = hg.astype(idtype).to(ctx)
      x = torch.randn(
          (hg.num_nodes("user"),) + feat_size,
          requires_grad=True,
          device=ctx,
      )
  
      y = dgl.copy_u(hg, x, etype="like")
      y.sum().backward()
      x_grad = x.grad
  
      x.grad.zero_()
      u, v = hg.edges(etype="like")
      y_true = x[u.long()]
      y_true.sum().backward()
      x_grad_true = x.grad
  
      assert torch.allclose(y, y_true)
      assert torch.allclose(x_grad, x_grad_true)
  
file_path: dgl/tests/python/pytorch/mpops/test_edgewise.py
imports: import random
  import backend
  import dgl
  import numpy
  import pytest
  import torch
  from utils import parametrize_idtype
label_desc: Use image node_id 2 for calling a global function with example usage: test_copy_u_hetero(idtype, feat_size) without return types