class_docstr: Implementation of Dataset class
  
  This is a simple implementation of loading and processing dataset for metapath2vec model.
  
  Args:
      config: dict, some configure parameters.
class_docstr_tok: ["Implementation","of","Dataset","class","This","is","a","simple","implementation","of","loading","and","processing","dataset","for","metapath2vec","model",".","Args",":","config",":","dict",",","some","configure","parameters","."]
docstr: Generate train pairs data for training model.
          
docstr_tok: ["Generate","train","pairs","data","for","training","model","."]
code: def gen_pairs(self, walks):
      """Generate train pairs data for training model."""
      src = []
      pos = []
      negs = []
      skip_window = self.config["win_size"] // 2
      for walk in walks:
          for i in range(len(walk)):
              for j in range(1, skip_window + 1):
                  if i - j >= 0:
                      src.append(walk[i])
                      pos.append(walk[i - j])
                      negs.append(
                          self.getNegatives(size=self.config["neg_num"])
                      )
                  if i + j < len(walk):
                      src.append(walk[i])
                      pos.append(walk[i + j])
                      negs.append(
                          self.getNegatives(size=self.config["neg_num"])
                      )
  
      src = np.array(src, dtype=np.int64).reshape(-1, 1, 1)
      pos = np.array(pos, dtype=np.int64).reshape(-1, 1, 1)
      negs = np.expand_dims(np.array(negs, dtype=np.int64), -1)
      return {"src": src, "pos": pos, "negs": negs}
  
file_path: PGL/legacy/examples/metapath2vec/Dataset.py
imports: import sys
  import os
  import glob
  import numpy
  import tqdm
  import time
  import logging
  import random
  from pgl import heter_graph
  import pickle
label_desc: Use image node_id 8 for calling the Dataset obj's underlying member method code with example usage: obj.gen_pairs(walks) and returns: dict