class_docstr: Dataset with output ports
  
  Please Note: Subclasses of IterableDataset should *not* implement input_types.
class_docstr_tok: ["Dataset","with","output","ports","Please","Note",":","Subclasses","of","IterableDataset","should","*","not","*","implement","input_types","."]
docstr: This is the method that user pass as functor to DataLoader.
  The method optionally performs neural type checking and add types to the outputs.
  
  Please note, subclasses of Dataset should not implement `input_types`.
  
  # Usage:
  dataloader = torch.utils.data.DataLoader(
          ....,
          collate_fn=dataset.collate_fn,
          ....
  )
  
  Returns:
      Collated batch, with or without types.
docstr_tok: ["This","is","the","method","that","user","pass","as","functor","to","DataLoader",".","The","method","optionally","performs","neural","type","checking","and","add","types","to","the","outputs",".","Please","note",",","subclasses","of","Dataset","should","not","implement","`","input_types","`",".","#","Usage",":","dataloader","=","torch.utils.data.DataLoader","(","....",",","collate_fn=dataset.collate_fn",",","....",")","Returns",":","Collated","batch",",","with","or","without","types","."]
code: def collate_fn(self, batch):
      """
      This is the method that user pass as functor to DataLoader.
      The method optionally performs neural type checking and add types to the outputs.
  
      Please note, subclasses of Dataset should not implement `input_types`.
  
      # Usage:
      dataloader = torch.utils.data.DataLoader(
              ....,
              collate_fn=dataset.collate_fn,
              ....
      )
  
      Returns:
          Collated batch, with or without types.
      """
      if self.input_types is not None:
          raise TypeError(
              "Datasets should not implement `input_types` as they are not checked"
          )
  
      # Simply forward the inner `_collate_fn`
      return self._collate_fn(batch)
  
file_path: NeMo/nemo/core/classes/dataset.py
imports: from dataclasses import dataclass
  from typing import Optional
  from torch.utils import data
  from nemo.core.classes import Serialization, Typing, typecheck
label_desc: Use image node_id 2 for calling the Dataset obj's underlying member method code with example usage: obj.collate_fn(batch) and returns: self