docstr: Return a new iterator over the dataset.
  
  Args:
      shuffle (bool, optional): shuffle batches before returning the
          iterator. Default: ``True``
      fix_batches_to_gpus: ensure that batches are always
          allocated to the same shards across epochs. Requires
          that :attr:`dataset` supports prefetching. Default:
          ``False``
docstr_tok: ["Return","a","new","iterator","over","the","dataset",".","Args",":","shuffle","(","bool",",","optional",")",":","shuffle","batches","before","returning","the","iterator",".","Default",":","``","True","``","fix_batches_to_gpus",":","ensure","that","batches","are","always","allocated","to","the","same","shards","across","epochs",".","Requires","that",":","attr",":","`","dataset","`","supports","prefetching",".","Default",":","``","False","``"]
code: def next_epoch_itr(self, shuffle=True, fix_batches_to_gpus=False):
      """Return a new iterator over the dataset.
  
      Args:
          shuffle (bool, optional): shuffle batches before returning the
              iterator. Default: ``True``
          fix_batches_to_gpus: ensure that batches are always
              allocated to the same shards across epochs. Requires
              that :attr:`dataset` supports prefetching. Default:
              ``False``
      """
      if self.weights and isinstance(
          self.dataset, RoundRobinZipDatasets
      ):
          """
          Set dataset weight based on schedule and current epoch
          """
          prev_scheduled_epochs = 0
          dataset_weights_map = None
          for schedule in self.weights:
              # schedule looks like (num_epochs, {dataset: weight})
              if self.epoch <= schedule[0] + prev_scheduled_epochs:
                  dataset_weights_map = schedule[1]
                  break
              prev_scheduled_epochs += schedule[0]
          # Use last weights map if weights map is not specified for the current epoch
          if dataset_weights_map is None:
              dataset_weights_map = self.weights[-1][1]
          for dataset_name in self.dataset.datasets:
              if dataset_name in dataset_weights_map:
                  assert isinstance(
                      self.dataset.datasets[dataset_name],
                      weighted_data.WeightedLanguagePairDataset,
                  ) or isinstance(
                      self.dataset.datasets[dataset_name],
                      weighted_data.WeightedBacktranslationDataset,
                  )
                  self.dataset.datasets[dataset_name].weights = [
                      dataset_weights_map[dataset_name]
                  ]
      if self._next_epoch_itr is not None:
          self._cur_epoch_itr = self._next_epoch_itr
          self._next_epoch_itr = None
      else:
          self.epoch += 1
          self._cur_epoch_itr = self._get_iterator_for_epoch(
              self.epoch,
              shuffle,
              fix_batches_to_gpus=fix_batches_to_gpus,
          )
      return self._cur_epoch_itr
  
imports: from fairseq.data import iterators, RoundRobinZipDatasets
  from pytorch_translate.data import weighted_data
label_desc: Use image node_id 2 for calling the WeightedEpochBatchIterator obj's underlying member method code with example usage: obj.next_epoch_itr(shuffle, fix_batches_to_gpus) and returns: self