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.
docstr: Initialize.
  
  Args:
      sampler (Sampler or Iterable): Base sampler. Can be any iterable object
      drop_last (bool): if to drop last mini-batch from a group if it is smaller than batch_size.
          Defaults to False.
      shuffle (bool): if to shuffle dataset. Defaults to False.
      batch_size (int, optional): Number of samples in a mini-batch. This is rather the maximum number
          of samples. Because mini-batches are grouped by prediction time, chances are that there
          are multiple where batch size will be smaller than the maximum. Defaults to 64.
docstr_tok: ["Initialize",".","Args",":","sampler","(","Sampler","or","Iterable",")",":","Base","sampler",".","Can","be","any","iterable","object","drop_last","(","bool",")",":","if","to","drop","last","mini-batch","from","a","group","if","it","is","smaller","than","batch_size",".","Defaults","to","False",".","shuffle","(","bool",")",":","if","to","shuffle","dataset",".","Defaults","to","False",".","batch_size","(","int",",","optional",")",":","Number","of","samples","in","a","mini-batch",".","This","is","rather","the","maximum","number","of","samples",".","Because","mini-batches","are","grouped","by","prediction","time",",","chances","are","that","there","are","multiple","where","batch","size","will","be","smaller","than","the","maximum",".","Defaults","to","64","."]
code: def __init__(
      self,
      sampler: Sampler,
      batch_size: int = 64,
      shuffle: bool = False,
      drop_last: bool = False,
  ):
      """
      Initialize.
  
      Args:
          sampler (Sampler or Iterable): Base sampler. Can be any iterable object
          drop_last (bool): if to drop last mini-batch from a group if it is smaller than batch_size.
              Defaults to False.
          shuffle (bool): if to shuffle dataset. Defaults to False.
          batch_size (int, optional): Number of samples in a mini-batch. This is rather the maximum number
              of samples. Because mini-batches are grouped by prediction time, chances are that there
              are multiple where batch size will be smaller than the maximum. Defaults to 64.
      """
      # Since collections.abc.Iterable does not check for `__getitem__`, which
      # is one way for an object to be an iterable, we don't do an `isinstance`
      # check here.
      if (
          not isinstance(batch_size, int)
          or isinstance(batch_size, bool)
          or batch_size <= 0
      ):
          raise ValueError(
              "batch_size should be a positive integer value, "
              "but got batch_size={}".format(batch_size)
          )
      if not isinstance(drop_last, bool):
          raise ValueError(
              "drop_last should be a boolean value, but got "
              "drop_last={}".format(drop_last)
          )
      self.sampler = sampler
      self.batch_size = batch_size
      self.drop_last = drop_last
      self.shuffle = shuffle
      # make groups and construct new index to sample from
      groups = self.get_groups(self.sampler)
      self.construct_batch_groups(groups)
  
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 1 to create a new GroupedSampler object from inherited base classes: Sampler with example: obj = GroupedSampler(sampler, batch_size, shuffle, drop_last)