class_docstr: A wrapper around torch.utils.data.Dataset for monolingual data.
  
  Args:
      dataset (torch.utils.data.Dataset): dataset to wrap
      sizes (List[int]): sentence lengths
      vocab (~fairseq.data.Dictionary): vocabulary
      shuffle (bool, optional): shuffle the elements before batching
          (default: True).
class_docstr_tok: ["A","wrapper","around","torch.utils.data.Dataset","for","monolingual","data",".","Args",":","dataset","(","torch.utils.data.Dataset",")",":","dataset","to","wrap","sizes","(","List","[","int","]",")",":","sentence","lengths","vocab","(","~fairseq.data.Dictionary",")",":","vocabulary","shuffle","(","bool",",","optional",")",":","shuffle","the","elements","before","batching","(","default",":","True",")","."]
docstr: Merge a list of samples to form a mini-batch.
  
  Args:
      samples (List[dict]): samples to collate
  
  Returns:
      dict: a mini-batch with the following keys:
  
          - `id` (LongTensor): example IDs in the original input order
          - `ntokens` (int): total number of tokens in the batch
          - `net_input` (dict): the input to the Model, containing keys:
  
            - `src_tokens` (LongTensor): a padded 2D Tensor of tokens in
              the source sentence of shape `(bsz, src_len)`. Padding will
              appear on the right.
  
          - `target` (LongTensor): a padded 2D Tensor of tokens in the
            target sentence of shape `(bsz, tgt_len)`. Padding will appear
            on the right.
docstr_tok: ["Merge","a","list","of","samples","to","form","a","mini-batch",".","Args",":","samples","(","List","[","dict","]",")",":","samples","to","collate","Returns",":","dict",":","a","mini-batch","with","the","following","keys",":","-","`","id","`","(","LongTensor",")",":","example","IDs","in","the","original","input","order","-","`","ntokens","`","(","int",")",":","total","number","of","tokens","in","the","batch","-","`","net_input","`","(","dict",")",":","the","input","to","the","Model",",","containing","keys",":","-","`","src_tokens","`","(","LongTensor",")",":","a","padded","2D","Tensor","of","tokens","in","the","source","sentence","of","shape","`","(","bsz",",","src_len",")","`",".","Padding","will","appear","on","the","right",".","-","`","target","`","(","LongTensor",")",":","a","padded","2D","Tensor","of","tokens","in","the","target","sentence","of","shape","`","(","bsz",",","tgt_len",")","`",".","Padding","will","appear","on","the","right","."]
code: def collater(self, samples):
      """Merge a list of samples to form a mini-batch.
  
      Args:
          samples (List[dict]): samples to collate
  
      Returns:
          dict: a mini-batch with the following keys:
  
              - `id` (LongTensor): example IDs in the original input order
              - `ntokens` (int): total number of tokens in the batch
              - `net_input` (dict): the input to the Model, containing keys:
  
                - `src_tokens` (LongTensor): a padded 2D Tensor of tokens in
                  the source sentence of shape `(bsz, src_len)`. Padding will
                  appear on the right.
  
              - `target` (LongTensor): a padded 2D Tensor of tokens in the
                target sentence of shape `(bsz, tgt_len)`. Padding will appear
                on the right.
      """
      return collate(
          samples,
          self.vocab.pad(),
          self.vocab.eos(),
          self.fixed_pad_length,
          self.pad_to_bsz,
      )
  
file_path: fairseq/fairseq/data/monolingual_dataset.py
imports: import numpy
  import torch
  from .None import FairseqDataset, data_utils
label_desc: Use image node_id 8 for calling the MonolingualDataset obj's underlying member method code with example usage: obj.collater(samples) and returns: collate