class_docstr: Top-level loop where validation/testing starts.
docstr: Resets the internal state of the loop.
docstr_tok: ["Resets","the","internal","state","of","the","loop","."]
code: def reset(self) -> None:
      """Resets the internal state of the loop."""
      trainer = self.trainer
  
      self._has_run = False
      self._logged_outputs = []
  
      if not self.restarting:
          self.batch_progress.reset_on_run()
      else:
          self.batch_progress.reset_on_restart()
      fn = trainer.state.fn
      assert fn is not None
      # when restarting, if we are running `validate` or `test` twice, since there's no concept of `max_epochs` we
      # need to reset the current state when the loop has finished running
      if fn != TrainerFn.FITTING:
          self.batch_progress.reset_on_run()
  
      assert trainer.state.stage is not None
      data_fetcher = _select_data_fetcher(trainer, trainer.state.stage)
      combined_loader = self._combined_loader
      assert combined_loader is not None
  
      if fn == TrainerFn.FITTING:
          for i, dl in enumerate(combined_loader.flattened):
              # some users want validation shuffling based on the training progress
              _set_sampler_epoch(
                  dl, trainer.fit_loop.epoch_progress.current.processed
              )
  
      # set the per-dataloader limits
      combined_loader.limits = self.max_batches
      data_fetcher.setup(combined_loader)
      iter(data_fetcher)  # creates the iterator inside the fetcher
  
      # add the previous `fetched` value to properly track `is_last_batch` with no prefetching
      data_fetcher.fetched += self.batch_progress.current.ready
      data_fetcher._start_profiler = self._on_before_fetch
      data_fetcher._stop_profiler = self._on_after_fetch
      self._data_fetcher = data_fetcher
  
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 9 for calling the _EvaluationLoop obj's underlying member method code with example usage: obj.reset() without return types