class_docstr: Hooks to be used for data related stuff.
class_docstr_tok: ["Hooks","to","be","used","for","data","related","stuff","."]
docstr: An iterable or collection of iterables specifying training samples.
  
  For more information about multiple dataloaders, see this :ref:`section <multiple-dataloaders>`.
  
  The dataloader you return will not be reloaded unless you set
  :paramref:`~lightning.pytorch.trainer.trainer.Trainer.reload_dataloaders_every_n_epochs` to
  a positive integer.
  
  For data processing use the following pattern:
  
      - download in :meth:`prepare_data`
      - process and split in :meth:`setup`
  
  However, the above are only necessary for distributed processing.
  
  .. warning:: do not assign state in prepare_data
  
  - :meth:`~lightning.pytorch.trainer.trainer.Trainer.fit`
  - :meth:`prepare_data`
  - :meth:`setup`
  
  Note:
      Lightning tries to add the correct sampler for distributed and arbitrary hardware.
      There is no need to set it yourself.
code: def train_dataloader(self) -> TRAIN_DATALOADERS:
      """An iterable or collection of iterables specifying training samples.
  
      For more information about multiple dataloaders, see this :ref:`section <multiple-dataloaders>`.
  
      The dataloader you return will not be reloaded unless you set
      :paramref:`~lightning.pytorch.trainer.trainer.Trainer.reload_dataloaders_every_n_epochs` to
      a positive integer.
  
      For data processing use the following pattern:
  
          - download in :meth:`prepare_data`
          - process and split in :meth:`setup`
  
      However, the above are only necessary for distributed processing.
  
      .. warning:: do not assign state in prepare_data
  
      - :meth:`~lightning.pytorch.trainer.trainer.Trainer.fit`
      - :meth:`prepare_data`
      - :meth:`setup`
  
      Note:
          Lightning tries to add the correct sampler for distributed and arbitrary hardware.
          There is no need to set it yourself.
  
      """
      raise MisconfigurationException(
          "`train_dataloader` must be implemented to be used with the Lightning Trainer"
      )
  
imports: from typing import Any, Dict, Optional
  import torch
  from torch import Tensor
  from torch.optim.optimizer import Optimizer
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_0
  from lightning.pytorch.utilities import move_data_to_device
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.types import EVAL_DATALOADERS, STEP_OUTPUT, TRAIN_DATALOADERS
label_desc: Use image node_id 5 for calling the DataHooks obj's underlying member method code with example usage: obj.train_dataloader() without return types