code: def test_unique_and_compact_hetero():
      N1 = torch.tensor(
          [0, 5, 2, 7, 12, 7, 9, 5, 6, 2, 3, 4, 1, 0, 9], device=F.ctx()
      )
      N2 = torch.tensor(
          [0, 3, 3, 5, 2, 7, 2, 8, 4, 9, 2, 3], device=F.ctx()
      )
      N3 = torch.tensor([1, 2, 6, 6, 1, 8, 3, 6, 3, 2], device=F.ctx())
      expected_unique = {
          "n1": torch.tensor(
              [0, 5, 2, 7, 12, 9, 6, 3, 4, 1], device=F.ctx()
          ),
          "n2": torch.tensor([0, 3, 5, 2, 7, 8, 4, 9], device=F.ctx()),
          "n3": torch.tensor([1, 2, 6, 8, 3], device=F.ctx()),
      }
      if N1.is_cuda:
          expected_reverse_id = {
              k: v.sort()[1] for k, v in expected_unique.items()
          }
          expected_unique = {
              k: v.sort()[0] for k, v in expected_unique.items()
          }
      else:
          expected_reverse_id = {
              k: torch.arange(0, v.shape[0], device=F.ctx())
              for k, v in expected_unique.items()
          }
      nodes_dict = {
          "n1": N1.split(5),
          "n2": N2.split(4),
          "n3": N3.split(2),
      }
      expected_nodes_dict = {
          "n1": [
              torch.tensor([0, 1, 2, 3, 4], device=F.ctx()),
              torch.tensor([3, 5, 1, 6, 2], device=F.ctx()),
              torch.tensor([7, 8, 9, 0, 5], device=F.ctx()),
          ],
          "n2": [
              torch.tensor([0, 1, 1, 2], device=F.ctx()),
              torch.tensor([3, 4, 3, 5], device=F.ctx()),
              torch.tensor([6, 7, 3, 1], device=F.ctx()),
          ],
          "n3": [
              torch.tensor([0, 1], device=F.ctx()),
              torch.tensor([2, 2], device=F.ctx()),
              torch.tensor([0, 3], device=F.ctx()),
              torch.tensor([4, 2], device=F.ctx()),
              torch.tensor([4, 1], device=F.ctx()),
          ],
      }
  
      unique, compacted = gb.unique_and_compact(nodes_dict)
      for ntype, nodes in unique.items():
          expected_nodes = expected_unique[ntype]
          assert torch.equal(nodes, expected_nodes)
  
      for ntype, nodes in compacted.items():
          expected_nodes = expected_nodes_dict[ntype]
          assert isinstance(nodes, list)
          for expected_node, node in zip(expected_nodes, nodes):
              node = expected_reverse_id[ntype][node]
              assert torch.equal(expected_node, node)
  
file_path: dgl/tests/python/pytorch/graphbolt/test_graphbolt_utils.py
imports: import backend
  import dgl.graphbolt
  import pytest
  import torch
label_desc: Use image node_id 5 for calling a global function with example usage: test_unique_and_compact_hetero() without return types