code: def collate(batches):
      all_u = [
          u for batch in batches for u, _, _ in batch if len(batch) > 0
      ]
      all_v = [
          v for batch in batches for _, v, _ in batch if len(batch) > 0
      ]
      all_neg_v = [
          neg_v
          for batch in batches
          for _, _, neg_v in batch
          if len(batch) > 0
      ]
  
      return (
          torch.LongTensor(all_u),
          torch.LongTensor(all_v),
          torch.LongTensor(all_neg_v),
      )
  
file_path: dgl/examples/pytorch/metapath2vec/reading_data.py
imports: import numpy
  import torch
  from download import AminerDataset
  from torch.utils.data import Dataset
label_desc: Use image node_id 4 for calling the Metapath2vecDataset obj's underlying member method code with example usage: obj.collate(batches) and returns: torch,  torch,  torch