code: def test_unique_and_compact_homo():
      N = torch.tensor(
          [0, 5, 2, 7, 12, 7, 9, 5, 6, 2, 3, 4, 1, 0, 9], device=F.ctx()
      )
      expected_unique_N = torch.tensor(
          [0, 5, 2, 7, 12, 9, 6, 3, 4, 1], device=F.ctx()
      )
      if N.is_cuda:
          expected_reverse_id_N = expected_unique_N.sort()[1]
          expected_unique_N = expected_unique_N.sort()[0]
      else:
          expected_reverse_id_N = torch.arange(
              0, expected_unique_N.shape[0], device=F.ctx()
          )
      nodes_list = N.split(5)
      expected_nodes_list = [
          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()),
      ]
  
      unique, compacted = gb.unique_and_compact(nodes_list)
  
      assert torch.equal(unique, expected_unique_N)
      assert isinstance(compacted, list)
      for expected_node, node in zip(expected_nodes_list, compacted):
          node = expected_reverse_id_N[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 6 for calling a global function with example usage: test_unique_and_compact_homo() without return types