class_docstr: Hooks to be used for data related stuff.
class_docstr_tok: ["Hooks","to","be","used","for","data","related","stuff","."]
docstr: Called at the beginning of fit (train + validate), validate, test, or predict. This is a good hook when you
  need to build models dynamically or adjust something about them. This hook is called on every process when
  using DDP.
  
  Args:
      stage: either ``'fit'``, ``'validate'``, ``'test'``, or ``'predict'``
  
  Example::
  
      class LitModel(...):
          def __init__(self):
              self.l1 = None
  
          def prepare_data(self):
              download_data()
              tokenize()
  
              # don't do this
              self.something = else
  
          def setup(self, stage):
              data = load_data(...)
              self.l1 = nn.Linear(28, data.num_classes)
code: def setup(self, stage: str) -> None:
      """Called at the beginning of fit (train + validate), validate, test, or predict. This is a good hook when you
      need to build models dynamically or adjust something about them. This hook is called on every process when
      using DDP.
  
      Args:
          stage: either ``'fit'``, ``'validate'``, ``'test'``, or ``'predict'``
  
      Example::
  
          class LitModel(...):
              def __init__(self):
                  self.l1 = None
  
              def prepare_data(self):
                  download_data()
                  tokenize()
  
                  # don't do this
                  self.something = else
  
              def setup(self, stage):
                  data = load_data(...)
                  self.l1 = nn.Linear(28, data.num_classes)
  
      """
  
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 3 for calling the DataHooks obj's underlying member method code with example usage: obj.setup(stage) without return types