code: def test_subgraph():
      edge_index = torch.tensor(
          [
              [0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6],
              [1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5],
          ]
      )
      edge_attr = torch.tensor(
          [
              1.0,
              2.0,
              3.0,
              4.0,
              5.0,
              6.0,
              7.0,
              8.0,
              9.0,
              10.0,
              11.0,
              12.0,
          ]
      )
  
      idx = torch.tensor([3, 4, 5])
      mask = index_to_mask(idx, 7)
      indices = idx.tolist()
  
      for subset in [idx, mask, indices]:
          out = subgraph(
              subset, edge_index, edge_attr, return_edge_mask=True
          )
          assert out[0].tolist() == [[3, 4, 4, 5], [4, 3, 5, 4]]
          assert out[1].tolist() == [7.0, 8.0, 9.0, 10.0]
          assert out[2].tolist() == [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0]
  
          out = subgraph(
              subset, edge_index, edge_attr, relabel_nodes=True
          )
          assert out[0].tolist() == [[0, 1, 1, 2], [1, 0, 2, 1]]
          assert out[1].tolist() == [7, 8, 9, 10]
  
file_path: pytorch_geometric/test/utils/test_subgraph.py
imports: import torch
  from torch_geometric.nn import GCNConv, Linear
  from torch_geometric.testing import withCUDA, withPackage
  from torch_geometric.utils import bipartite_subgraph, get_num_hops, index_to_mask, k_hop_subgraph, subgraph
label_desc: Use image node_id 2 for calling a global function with example usage: test_subgraph() without return types