code: def __iter__(self):
      perm = np.arange(0, len(self.dataset))
      if self.shuffle:
          np.random.shuffle(perm)
  
      batch = []
      for idx in perm:
          batch.append(idx)
          if len(batch) == self.batch_size:
              yield batch
              batch = []
  
      if len(batch) > 0 and not self.drop_last:
          yield batch
  
file_path: PGL/legacy/pgl/utils/data/sampler.py
imports: import time
  import numpy
label_desc: Use image node_id 2 for calling the Sampler obj's underlying member method code with example usage: obj.__iter__() without return types