class_docstr: Samples mini-batches randomly but in a grouped manner.
  
  This means that the items from the different groups are always sampled together.
  This is an abstract class. Implement the :py:meth:`~get_groups` method which creates groups to be sampled from.
code: def __iter__(self):
      if self.shuffle:  # shuffle samples
          groups = {
              name: shuffle(group)
              for name, group in self._groups.items()
          }
          batch_samples = np.random.permutation(len(self))
      else:
          groups = self._groups
          batch_samples = np.arange(len(self))
  
      for idx in batch_samples:
          name = self._group_index[idx]
          sub_group = self._sub_group_index[idx]
          sub_group_start = sub_group * self.batch_size
          sub_group_end = sub_group_start + self.batch_size
          batch = groups[name][sub_group_start:sub_group_end]
          yield batch
  
file_path: pytorch-forecasting/pytorch_forecasting/data/samplers.py
imports: import warnings
  import numpy
  import pandas
  from sklearn.utils import shuffle
  import torch
  from torch.utils.data.sampler import Sampler
label_desc: Use image node_id 4 for calling the GroupedSampler obj's underlying member method code with example usage: obj.__iter__() without return types