class_docstr: Adds additional edge types similar to :class:`AddMetaPaths`.
  The key difference is that the added edge type is given by
  multiple random walks along the metapath.
  One might want to increase the number of random walks
  via :obj:`walks_per_node` to achieve competitive performance with
  :class:`AddMetaPaths`.
  
  Args:
      metapaths (List[List[Tuple[str, str, str]]]): The metapaths described
          by a list of lists of
          :obj:`(src_node_type, rel_type, dst_node_type)` tuples.
      drop_orig_edge_types (bool, optional): If set to :obj:`True`, existing
          edge types will be dropped. (default: :obj:`False`)
      keep_same_node_type (bool, optional): If set to :obj:`True`, existing
          edge types between the same node type are not dropped even in case
          :obj:`drop_orig_edge_types` is set to :obj:`True`.
          (default: :obj:`False`)
      drop_unconnected_node_types (bool, optional): If set to :obj:`True`,
          will drop node types not connected by any edge type.
          (default: :obj:`False`)
      walks_per_node (int, List[int], optional): The number of random walks
          for each starting node in a metapth. (default: :obj:`1`)
      sample_ratio (float, optional): The ratio of source nodes to start
          random walks from. (default: :obj:`1.0`)
docstr: Sample neighbors from :obj:`edge_index` for each node in
  :obj:`subset`.
docstr_tok: ["Sample","neighbors","from",":","obj",":","`","edge_index","`","for","each","node","in",":","obj",":","`","subset","`","."]
code: def sample(
      edge_index: EdgeIndex, subset: Tensor
  ) -> Tuple[Tensor, Tensor]:
      """Sample neighbors from :obj:`edge_index` for each node in
      :obj:`subset`.
      """
      edge_index, _ = edge_index.sort_by("row")
      rowptr = edge_index.get_indptr()
      rowcount = rowptr.diff()[subset]
  
      mask = rowcount > 0
      offset = torch.zeros_like(subset)
      offset[mask] = rowptr[subset[mask]]
  
      rand = torch.rand((rowcount.size(0), 1), device=subset.device)
      rand.mul_(rowcount.to(rand.dtype).view(-1, 1))
      rand = rand.to(torch.long)
      rand.add_(offset.view(-1, 1))
      col = edge_index[1][rand].squeeze()
      return col, mask
  
imports: import warnings
  from typing import List, Optional, Tuple, Union, cast
  import torch
  from torch import Tensor
  from torch_geometric import EdgeIndex
  from torch_geometric.data import HeteroData
  from torch_geometric.data.datapipes import functional_transform
  from torch_geometric.transforms import BaseTransform
  from torch_geometric.typing import EdgeType
  from torch_geometric.utils import coalesce, degree
label_desc: Use image node_id 3 for calling the AddRandomMetaPaths obj's underlying member method code with example usage: obj.sample(edge_index, subset) and returns: col,  mask