class_docstr: A wrapper around TokenBlockDataset for BART dataset.
  
  Args:
      dataset (TokenBlockDataset): dataset to wrap
      sizes (List[int]): sentence lengths
      vocab (~fairseq.data.Dictionary): vocabulary
      mask_idx (int): dictionary index used for masked token
      mask_whole_words: only mask whole words. This should be a byte mask
          over vocab indices, indicating whether it is the beginning of a
          word. We will extend any mask to encompass the whole word.
      shuffle (bool, optional): shuffle the elements before batching.
        Default: ``True``
      seed: Seed for random number generator for reproducibility.
class_docstr_tok: ["A","wrapper","around","TokenBlockDataset","for","BART","dataset",".","Args",":","dataset","(","TokenBlockDataset",")",":","dataset","to","wrap","sizes","(","List","[","int","]",")",":","sentence","lengths","vocab","(","~fairseq.data.Dictionary",")",":","vocabulary","mask_idx","(","int",")",":","dictionary","index","used","for","masked","token","mask_whole_words",":","only","mask","whole","words",".","This","should","be","a","byte","mask","over","vocab","indices",",","indicating","whether","it","is","the","beginning","of","a","word",".","We","will","extend","any","mask","to","encompass","the","whole","word",".","shuffle","(","bool",",","optional",")",":","shuffle","the","elements","before","batching",".","Default",":","``","True","``","seed",":","Seed","for","random","number","generator","for","reproducibility","."]
code: def __getitem__(self, index):
      with data_utils.numpy_seed(self.seed, self.epoch, index):
          tokens = self.dataset[index]
          assert tokens[-1] == self.eos
          source, target = tokens, tokens.clone()
  
          if self.permute_sentence_ratio > 0.0:
              source = self.permute_sentences(
                  source, self.permute_sentence_ratio
              )
  
          if self.mask_ratio > 0:
              source = self.add_whole_word_mask(source, self.mask_ratio)
  
          if self.insert_ratio > 0:
              source = self.add_insertion_noise(
                  source, self.insert_ratio
              )
  
          if (
              self.rotate_ratio > 0.0
              and np.random.random() < self.rotate_ratio
          ):
              source = self.add_rolling_noise(source)
      # there can additional changes to make:
      if self.item_transform_func is not None:
          source, target = self.item_transform_func(source, target)
  
      assert (source >= 0).all()
      assert (source[1:-1] >= 1).all()
      assert (source <= len(self.vocab)).all()
      assert source[0] == self.vocab.bos()
      assert source[-1] == self.eos
      return {
          "id": index,
          "source": source,
          "target": target,
      }
  
imports: import math
  import numpy
  import torch
  from .None import FairseqDataset, data_utils
label_desc: Use image node_id 4 for calling the DenoisingDataset obj's underlying member method code with example usage: obj.__getitem__(index) and returns: dict