code: def __scale_batch_restore_params(
      trainer: "pl.Trainer", params: Dict[str, Any]
  ) -> None:
      # TODO: There are more states that needs to be reset (#4512 and #4870)
      trainer.loggers = params["loggers"]
      trainer.callbacks = params["callbacks"]
  
      loop = trainer._active_loop
      assert loop is not None
      if isinstance(loop, pl.loops._FitLoop):
          loop.epoch_loop.max_steps = params["max_steps"]
          trainer.limit_train_batches = params["limit_train_batches"]
          trainer.limit_val_batches = params["limit_val_batches"]
      elif isinstance(loop, pl.loops._EvaluationLoop):
          stage = trainer.state.stage
          assert stage is not None
          setattr(
              trainer,
              f"limit_{stage.dataloader_prefix}_batches",
              params["limit_eval_batches"],
          )
  
      loop.load_state_dict(deepcopy(params["loop_state_dict"]))
      loop.restarting = False
      if (
          isinstance(loop, pl.loops._EvaluationLoop)
          and "loop_verbose" in params
      ):
          loop.verbose = params["loop_verbose"]
  
      # make sure the loop's state is reset
      _reset_dataloaders(trainer)
      loop.reset()
  
file_path: pytorch-lightning/src/lightning/pytorch/tuner/batch_size_scaling.py
imports: import logging
  import os
  import uuid
  from copy import deepcopy
  from typing import Any, Dict, Optional, Tuple
  import lightning.pytorch
  from lightning.pytorch.utilities.memory import garbage_collection_cuda, is_oom_error
  from lightning.pytorch.utilities.parsing import lightning_getattr, lightning_setattr
  from lightning.pytorch.utilities.rank_zero import rank_zero_info, rank_zero_warn
label_desc: Use image node_id 4 for calling a global function with example usage: __scale_batch_restore_params(trainer, params) without return types