class_docstr: A data loader that randomly samples nodes within a graph and returns
  their induced subgraph.
  
  .. note::
  
      For an example of using
      :class:`~torch_geometric.loader.RandomNodeLoader`, see
      `examples/ogbn_proteins_deepgcn.py
      <https://github.com/pyg-team/pytorch_geometric/blob/master/examples/
      ogbn_proteins_deepgcn.py>`_.
  
  Args:
      data (torch_geometric.data.Data or torch_geometric.data.HeteroData):
          The :class:`~torch_geometric.data.Data` or
          :class:`~torch_geometric.data.HeteroData` graph object.
      num_parts (int): The number of partitions.
      **kwargs (optional): Additional arguments of
          :class:`torch.utils.data.DataLoader`, such as :obj:`num_workers`.
code: def collate_fn(self, index):
      if not isinstance(index, Tensor):
          index = torch.tensor(index)
  
      if isinstance(self.data, Data):
          return self.data.subgraph(index)
  
      elif isinstance(self.data, HeteroData):
          node_dict = {
              key: index[(index >= start) & (index < end)] - start
              for key, (start, end) in self.node_dict.items()
          }
          return self.data.subgraph(node_dict)
  
file_path: pytorch_geometric/torch_geometric/loader/random_node_loader.py
imports: import math
  from typing import Union
  import torch
  from torch import Tensor
  from torch_geometric.data import Data, HeteroData
  from torch_geometric.data.hetero_data import to_homogeneous_edge_index
label_desc: Use image node_id 2 for calling the RandomNodeLoader obj's underlying member method code with example usage: obj.collate_fn(index) and returns: self, self