class_docstr: The partition sampler given a DGLGraph and partition number.
  The metis is used as the graph partition backend.
class_docstr_tok: ["The","partition","sampler","given","a","DGLGraph","and","partition","number",".","The","metis","is","used","as","the","graph","partition","backend","."]
docstr: Initialize the sampler.
  
  Paramters
  ---------
  dn : str
      The dataset name.
  g  : DGLGraph
      The full graph of dataset
  psize: int
      The partition number
  batch_size: int
      The number of partitions in one batch
  seed_nid: np.ndarray
      The training nodes ids, used to extract the training graph
docstr_tok: ["Initialize","the","sampler",".","Paramters","--","--","--","--","-","dn",":","str","The","dataset","name",".","g",":","DGLGraph","The","full","graph","of","dataset","psize",":","int","The","partition","number","batch_size",":","int","The","number","of","partitions","in","one","batch","seed_nid",":","np.ndarray","The","training","nodes","ids",",","used","to","extract","the","training","graph"]
code: def __init__(self, dn, g, psize, batch_size, seed_nid):
      """Initialize the sampler.
  
      Paramters
      ---------
      dn : str
          The dataset name.
      g  : DGLGraph
          The full graph of dataset
      psize: int
          The partition number
      batch_size: int
          The number of partitions in one batch
      seed_nid: np.ndarray
          The training nodes ids, used to extract the training graph
      """
      self.psize = psize
      self.batch_size = batch_size
      # cache the partitions of known datasets&partition number
      if dn:
          fn = os.path.join("./datasets/", dn + "_{}.npy".format(psize))
          if os.path.exists(fn):
              self.par_li = np.load(fn, allow_pickle=True)
          else:
              os.makedirs("./datasets/", exist_ok=True)
              self.par_li = get_partition_list(g, psize)
              self.par_li = np.array(self.par_li, dtype=object)
              np.save(fn, self.par_li)
      else:
          self.par_li = get_partition_list(g, psize)
      par_list = []
      for p in self.par_li:
          par = torch.Tensor(p)
          par_list.append(par)
      self.par_list = par_list
  
file_path: dgl/examples/pytorch/ogb/cluster-sage/sampler.py
imports: import os
  import random
  import time
  import torch
  from partition_utils import *
  import dgl.function
label_desc: Use image node_id 1 to create a new ClusterIter object from inherited base classes: object with example: obj = ClusterIter(dn, g, psize, batch_size, seed_nid)