class_docstr: Wraps another sampler to yield a mini-batch of indices.
  It enforces that the batch only contain elements from the same group.
  It also tries to provide mini-batches which follows an ordering which is
  as close as possible to the ordering from the original sampler.
class_docstr_tok: ["Wraps","another","sampler","to","yield","a","mini-batch","of","indices",".","It","enforces","that","the","batch","only","contain","elements","from","the","same","group",".","It","also","tries","to","provide","mini-batches","which","follows","an","ordering","which","is","as","close","as","possible","to","the","ordering","from","the","original","sampler","."]
code: def __iter__(self):
      for idx in self.sampler:
          group_id = self.group_ids[idx]
          group_buffer = self.buffer_per_group[group_id]
          group_buffer.append(idx)
          if len(group_buffer) == self.batch_size:
              yield group_buffer[:]  # yield a copy of the list
              del group_buffer[:]
  
imports: import numpy
  from torch.utils.data.sampler import BatchSampler, Sampler
label_desc: Use image node_id 2 for calling the GroupedBatchSampler obj's underlying member method code with example usage: obj.__iter__() without return types