code: def sample(
      rowptr: Tensor,
      col: Tensor,
      rowcount: Tensor,
      subset: Tensor,
      num_neighbors: int,
      dummy_idx: int,
  ) -> Tensor:
      mask = subset >= dummy_idx
      subset = subset.clamp(min=0, max=rowptr.numel() - 2)
      count = rowcount[subset]
  
      rand = torch.rand(
          (subset.size(0), num_neighbors), device=subset.device
      )
      rand *= count.to(rand.dtype).view(-1, 1)
      rand = rand.to(torch.long) + rowptr[subset].view(-1, 1)
  
      col = col[rand] if col.numel() > 0 else rand
      col[mask | (count == 0)] = dummy_idx
      return col
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  from torch import Tensor
  from torch.nn import Embedding
  from torch.utils.data import DataLoader
  from torch_geometric.typing import EdgeType, NodeType, OptTensor
  from torch_geometric.utils import sort_edge_index
  from torch_geometric.utils.sparse import index2ptr
label_desc: Use image node_id 1 for calling a global function with example usage: sample(rowptr, col, rowcount, subset, num_neighbors, dummy_idx) and returns: col