class_docstr: Top-level loop where validation/testing starts.
code: def setup_data(self) -> None:
      trainer = self.trainer
      trainer_fn = self._trainer_fn
      if (
          self._combined_loader is not None
          and trainer_fn == TrainerFn.FITTING
          and not self._should_reload_val_dl
      ):
          return
  
      pl_module = trainer.lightning_module
      limit_batches = (
          trainer.limit_test_batches
          if trainer.testing
          else trainer.limit_val_batches
      )
      hook_name = "test_step" if trainer.testing else "validation_step"
      if limit_batches == 0 or not is_overridden(hook_name, pl_module):
          return
  
      # store epoch of dataloader reset for reload_dataloaders_every_n_epochs
      # it should not reload again if it has already reloaded during sanity_check
      if trainer_fn == TrainerFn.FITTING and (
          (
              trainer.sanity_checking
              and trainer.fit_loop.epoch_loop._should_check_val_epoch()
          )
          or not trainer.sanity_checking
      ):
          self._last_val_dl_reload_epoch = trainer.current_epoch
  
      stage = self._stage
      source = self._data_source
      dataloaders = _request_dataloader(source)
      trainer.strategy.barrier(
          f"{stage.dataloader_prefix}_dataloader()"
      )
  
      if not isinstance(dataloaders, CombinedLoader):
          combined_loader = CombinedLoader(dataloaders, "sequential")
      else:
          combined_loader = dataloaders
  
      if (
          trainer_fn == TrainerFn.FITTING
          and trainer.overfit_batches > 0
      ):
          _resolve_overfit_batches(combined_loader, stage)
  
      dataloaders = []
      for dl in combined_loader.flattened:
          _check_dataloader_iterable(dl, source, trainer_fn)
          dl = _process_dataloader(trainer, trainer_fn, stage, dl)
          dataloaders.append(dl)
      combined_loader.flattened = dataloaders
      self._combined_loader = combined_loader
  
      allow_zero_length = (
          pl_module.allow_zero_length_dataloader_with_multiple_devices
      )
      if trainer.datamodule is not None:
          allow_zero_length |= (
              trainer.datamodule.allow_zero_length_dataloader_with_multiple_devices
          )
  
      self._max_batches = []
      for dl in combined_loader.flattened:
          # determine number of batches
          length = (
              len(dl)
              if has_len_all_ranks(
                  dl, trainer.strategy, allow_zero_length
              )
              else float("inf")
          )
          limit_batches = getattr(
              trainer, f"limit_{stage.dataloader_prefix}_batches"
          )
          num_batches = _parse_num_batches(stage, length, limit_batches)
          self._max_batches.append(num_batches)
  
      # this depends on the data used, so reset it too
      self._seen_batches_per_dataloader = defaultdict(int)
  
imports: import os
  import shutil
  import sys
  from collections import ChainMap, OrderedDict, defaultdict
  from typing import Any, DefaultDict, Iterable, Iterator, List, Optional, Tuple, Union
  from lightning_utilities.core.apply_func import apply_to_collection
  from torch import Tensor
  import lightning.pytorch
  from lightning.fabric.utilities.data import _set_sampler_epoch
  from lightning.pytorch.callbacks.progress.rich_progress import _RICH_AVAILABLE
  from lightning.pytorch.loops.fetchers import _DataFetcher, _DataLoaderIterDataFetcher
  from lightning.pytorch.loops.loop import _Loop
  from lightning.pytorch.loops.progress import _BatchProgress
  from lightning.pytorch.loops.utilities import _no_grad_context, _select_data_fetcher, _verify_dataloader_idx_requirement
  from lightning.pytorch.trainer import call
  from lightning.pytorch.trainer.connectors.data_connector import _check_dataloader_iterable, _DataLoaderSource, _parse_num_batches, _process_dataloader, _request_dataloader, _resolve_overfit_batches
  from lightning.pytorch.trainer.connectors.logger_connector.result import _OUT_DICT, _ResultCollection
  from lightning.pytorch.trainer.states import RunningStage, TrainerFn
  from lightning.pytorch.utilities.combined_loader import CombinedLoader
  from lightning.pytorch.utilities.data import has_len_all_ranks
  from lightning.pytorch.utilities.exceptions import SIGTERMException
  from lightning.pytorch.utilities.model_helpers import _ModuleMode, is_overridden
  from lightning.pytorch.utilities.signature_utils import is_param_in_hook_signature
label_desc: Use image node_id 8 for calling the _EvaluationLoop obj's underlying member method code with example usage: obj.setup_data() without return types