code: def test_minibatch_representation_hetero():
      csc_formats = [
          {
              relation: gb.CSCFormatBase(
                  indptr=torch.tensor([0, 1, 2, 3]),
                  indices=torch.tensor([0, 1, 1]),
              ),
              reverse_relation: gb.CSCFormatBase(
                  indptr=torch.tensor([0, 0, 0, 1, 2]),
                  indices=torch.tensor([1, 0]),
              ),
          },
          {
              relation: gb.CSCFormatBase(
                  indptr=torch.tensor([0, 1, 2]),
                  indices=torch.tensor([1, 0]),
              )
          },
      ]
      original_column_node_ids = [
          {
              "B": torch.tensor([10, 11, 12]),
              "A": torch.tensor([5, 7, 9, 11]),
          },
          {"B": torch.tensor([10, 11])},
      ]
      original_row_node_ids = [
          {
              "A": torch.tensor([5, 7, 9, 11]),
              "B": torch.tensor([10, 11, 12]),
          },
          {
              "A": torch.tensor([5, 7]),
              "B": torch.tensor([10, 11]),
          },
      ]
      original_edge_ids = [
          {
              relation: torch.tensor([19, 20, 21]),
              reverse_relation: torch.tensor([23, 26]),
          },
          {relation: torch.tensor([10, 12])},
      ]
      node_features = {
          ("A", "x"): torch.tensor([6, 4, 0, 1]),
      }
      edge_features = [
          {(relation, "x"): torch.tensor([4, 2, 4])},
          {(relation, "x"): torch.tensor([0, 6])},
      ]
      subgraphs = []
      for i in range(2):
          subgraphs.append(
              gb.SampledSubgraphImpl(
                  sampled_csc=csc_formats[i],
                  original_column_node_ids=original_column_node_ids[i],
                  original_row_node_ids=original_row_node_ids[i],
                  original_edge_ids=original_edge_ids[i],
              )
          )
      negative_srcs = {"B": torch.tensor([[8], [1], [6]])}
      negative_dsts = {"B": torch.tensor([[2], [8], [8]])}
      compacted_csc_formats = {
          relation: gb.CSCFormatBase(
              indptr=torch.tensor([0, 1, 2, 3]),
              indices=torch.tensor([3, 4, 5]),
          ),
          reverse_relation: gb.CSCFormatBase(
              indptr=torch.tensor([0, 0, 0, 1, 2]),
              indices=torch.tensor([0, 1]),
          ),
      }
      compacted_negative_srcs = {
          relation: torch.tensor([[0], [1], [2]])
      }
      compacted_negative_dsts = {
          relation: torch.tensor([[6], [0], [0]])
      }
      # Test minibatch with all attributes.
      minibatch = gb.MiniBatch(
          seed_nodes={"B": torch.tensor([10, 15])},
          node_pairs=csc_formats,
          sampled_subgraphs=subgraphs,
          node_features=node_features,
          edge_features=edge_features,
          labels={"B": torch.tensor([2, 5])},
          negative_srcs=negative_srcs,
          negative_dsts=negative_dsts,
          compacted_node_pairs=compacted_csc_formats,
          input_nodes={
              "A": torch.tensor([5, 7, 9, 11]),
              "B": torch.tensor([10, 11, 12]),
          },
          compacted_negative_srcs=compacted_negative_srcs,
          compacted_negative_dsts=compacted_negative_dsts,
      )
      expect_result = str(
          """MiniBatch(seed_nodes={'B': tensor([10, 15])},
            sampled_subgraphs=[SampledSubgraphImpl(sampled_csc={'A:r:B': CSCFormatBase(indptr=tensor([0, 1, 2, 3]),
                                                                           indices=tensor([0, 1, 1]),
                                                             ), 'B:rr:A': CSCFormatBase(indptr=tensor([0, 0, 0, 1, 2]),
                                                                           indices=tensor([1, 0]),
                                                             )},
                                                 original_row_node_ids={'A': tensor([ 5,  7,  9, 11]), 'B': tensor([10, 11, 12])},
                                                 original_edge_ids={'A:r:B': tensor([19, 20, 21]), 'B:rr:A': tensor([23, 26])},
                                                 original_column_node_ids={'B': tensor([10, 11, 12]), 'A': tensor([ 5,  7,  9, 11])},
                              ),
                              SampledSubgraphImpl(sampled_csc={'A:r:B': CSCFormatBase(indptr=tensor([0, 1, 2]),
                                                                           indices=tensor([1, 0]),
                                                             )},
                                                 original_row_node_ids={'A': tensor([5, 7]), 'B': tensor([10, 11])},
                                                 original_edge_ids={'A:r:B': tensor([10, 12])},
                                                 original_column_node_ids={'B': tensor([10, 11])},
                              )],
            positive_node_pairs={'A:r:B': CSCFormatBase(indptr=tensor([0, 1, 2, 3]),
                                              indices=tensor([3, 4, 5]),
                                ), 'B:rr:A': CSCFormatBase(indptr=tensor([0, 0, 0, 1, 2]),
                                              indices=tensor([0, 1]),
                                )},
            node_pairs_with_labels=({'A:r:B': CSCFormatBase(indptr=tensor([0, 1, 2, 3]),
                                                 indices=tensor([3, 4, 5]),
                                   ), 'B:rr:A': CSCFormatBase(indptr=tensor([0, 0, 0, 1, 2]),
                                                 indices=tensor([0, 1]),
                                   )},
                                   {'B': tensor([2, 5])}),
            node_pairs=[{'A:r:B': CSCFormatBase(indptr=tensor([0, 1, 2, 3]),
                                     indices=tensor([0, 1, 1]),
                       ), 'B:rr:A': CSCFormatBase(indptr=tensor([0, 0, 0, 1, 2]),
                                     indices=tensor([1, 0]),
                       )},
                       {'A:r:B': CSCFormatBase(indptr=tensor([0, 1, 2]),
                                     indices=tensor([1, 0]),
                       )}],
            node_features={('A', 'x'): tensor([6, 4, 0, 1])},
            negative_srcs={'B': tensor([[8],
                                  [1],
                                  [6]])},
            negative_node_pairs={'A:r:B': (tensor([[0],
                                        [1],
                                        [2]]), tensor([[6],
                                        [0],
                                        [0]]))},
            negative_dsts={'B': tensor([[2],
                                  [8],
                                  [8]])},
            labels={'B': tensor([2, 5])},
            input_nodes={'A': tensor([ 5,  7,  9, 11]), 'B': tensor([10, 11, 12])},
            edge_features=[{('A:r:B', 'x'): tensor([4, 2, 4])},
                          {('A:r:B', 'x'): tensor([0, 6])}],
            compacted_node_pairs={'A:r:B': CSCFormatBase(indptr=tensor([0, 1, 2, 3]),
                                               indices=tensor([3, 4, 5]),
                                 ), 'B:rr:A': CSCFormatBase(indptr=tensor([0, 0, 0, 1, 2]),
                                               indices=tensor([0, 1]),
                                 )},
            compacted_negative_srcs={'A:r:B': tensor([[0],
                                            [1],
                                            [2]])},
            compacted_negative_dsts={'A:r:B': tensor([[6],
                                            [0],
                                            [0]])},
            blocks=[Block(num_src_nodes={'A': 4, 'B': 3},
                         num_dst_nodes={'A': 4, 'B': 3},
                         num_edges={('A', 'r', 'B'): 3, ('B', 'rr', 'A'): 2},
                         metagraph=[('A', 'B', 'r'), ('B', 'A', 'rr')]),
                   Block(num_src_nodes={'A': 2, 'B': 2},
                         num_dst_nodes={'B': 2},
                         num_edges={('A', 'r', 'B'): 2},
                         metagraph=[('A', 'B', 'r')])],
         )"""
      )
      result = str(minibatch)
      assert result == expect_result, print(result)
  
file_path: dgl/tests/python/pytorch/graphbolt/impl/test_minibatch.py
imports: import dgl
  import dgl.graphbolt
  import pytest
  import torch
label_desc: Use image node_id 2 for calling a global function with example usage: test_minibatch_representation_hetero() without return types