code: def next_batch(self):
      if self.last_batch():
          raise StopIteration()
  
      indices = []
      for _ in range(self.batch_size):
          try:
              indices.append(next(self.sample_it))
              self.index += 1
          except StopIteration:
              break
  
      sub_batch = {
          feature_name: self.dataset.get(feature_name, indices)
          for feature_name in self.dataset.features
      }
  
      if self.augmentation_pipeline:
          for (
              feature_name,
              augmentations,
          ) in self.augmentation_pipeline.items():
              logger.debug(
                  f"RandomAccessBatcher applying augmentation pipeline to batch for feature {feature_name}"
              )
              sub_batch[feature_name] = augmentations(
                  torch.tensor(sub_batch[feature_name])
              )
  
      self.step += 1
      return sub_batch
  
file_path: ludwig/ludwig/data/batcher/random_access.py
imports: import logging
  import math
  import torch
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.data.batcher.base import Batcher
label_desc: Use image node_id 2 for calling the RandomAccessBatcher obj's underlying member method code with example usage: obj.next_batch() and returns: sub_batch