code: def __iter__(self):
      active_total_samples = self.total_samples - self.last_batch_size
      self.epoch = self.consumed_samples // active_total_samples
      current_epoch_samples = (
          self.consumed_samples % active_total_samples
      )
      assert (
          current_epoch_samples
          % (self.micro_batch_size * self.data_parallel_size)
          == 0
      )
  
      # data sharding and random sampling
      bucket_size = (
          self.total_samples
          // (self.micro_batch_size * self.data_parallel_size)
      ) * self.micro_batch_size
      bucket_offset = current_epoch_samples // self.data_parallel_size
      start_idx = self.data_parallel_rank * bucket_size
  
      g = torch.Generator()
      g.manual_seed(self.seed + self.epoch)
      random_idx = torch.randperm(bucket_size, generator=g).tolist()
      idx_range = [start_idx + x for x in random_idx[bucket_offset:]]
  
      batch = []
      # Last batch if not complete will be dropped.
      for idx in idx_range:
          batch.append(idx)
          if (
              len(batch)
              == self._global_batch_size_on_this_data_parallel_rank
          ):
              self.consumed_samples += self._global_batch_size
              yield batch
              batch = []
      # Check the last partial batch and see drop_last is set
      if len(batch) > 0 and not self.drop_last:
          yield batch
  
imports: import abc
  import warnings
  from typing import Tuple
  import torch
  from nemo.utils.decorators import experimental
label_desc: Use image node_id 3 for calling the MegatronPretrainingRandomBatchSampler obj's underlying member method code with example usage: obj.__iter__() without return types