class_docstr: Iterates over all batches in the dataloader (one epoch) that the user returns in their
  :meth:`~lightning.pytorch.core.LightningModule.train_dataloader` method.
  
  Its main responsibilities are calling the ``*_epoch_{start,end}`` hooks, accumulating outputs if the user request
  them in one of these hooks, and running validation at the requested interval.
  
  The validation is carried out by yet another loop,
  :class:`~lightning.pytorch.loops._EvaluationLoop`.
  
  In the ``run()`` method, the training epoch loop could in theory simply call the
  ``LightningModule.training_step`` already and perform the optimization.
  However, Lightning has built-in support for automatic optimization with multiple optimizers.
  For this reason there are actually two more loops nested under
  :class:`~lightning.pytorch.loops._TrainingEpochLoop`.
  
  Args:
      min_steps: The minimum number of steps (batches) to process
      max_steps: The maximum number of steps (batches) to process
class_docstr_tok: ["Iterates","over","all","batches","in","the","dataloader","(","one","epoch",")","that","the","user","returns","in","their",":","meth",":","`","~lightning.pytorch.core.LightningModule.train_dataloader","`","method",".","Its","main","responsibilities","are","calling","the","``","*","_epoch_","{","start",",","end","}","``","hooks",",","accumulating","outputs","if","the","user","request","them","in","one","of","these","hooks",",","and","running","validation","at","the","requested","interval",".","The","validation","is","carried","out","by","yet","another","loop",",",":","class",":","`","~lightning.pytorch.loops._EvaluationLoop","`",".","In","the","``","run","(",")","``","method",",","the","training","epoch","loop","could","in","theory","simply","call","the","``","LightningModule.training_step","``","already","and","perform","the","optimization",".","However",",","Lightning","has","built-in","support","for","automatic","optimization","with","multiple","optimizers",".","For","this","reason","there","are","actually","two","more","loops","nested","under",":","class",":","`","~lightning.pytorch.loops._TrainingEpochLoop","`",".","Args",":","min_steps",":","The","minimum","number","of","steps","(","batches",")","to","process","max_steps",":","The","maximum","number","of","steps","(","batches",")","to","process"]
docstr: Update learning rates.
  
  Args:
      interval: either 'epoch' or 'step'.
      update_plateau_schedulers: control whether ``ReduceLROnPlateau`` or non-plateau schedulers get updated.
          This is used so non-plateau schedulers can be updated before running validation. Checkpoints are
          commonly saved during validation, however, on-plateau schedulers might monitor a validation metric
          so they have to be updated separately.
docstr_tok: ["Update","learning","rates",".","Args",":","interval",":","either","'epoch","'","or","'step","'",".","update_plateau_schedulers",":","control","whether","``","ReduceLROnPlateau","``","or","non-plateau","schedulers","get","updated",".","This","is","used","so","non-plateau","schedulers","can","be","updated","before","running","validation",".","Checkpoints","are","commonly","saved","during","validation",",","however",",","on-plateau","schedulers","might","monitor","a","validation","metric","so","they","have","to","be","updated","separately","."]
code: def _update_learning_rates(
      self, interval: str, update_plateau_schedulers: bool
  ) -> None:
      """Update learning rates.
  
      Args:
          interval: either 'epoch' or 'step'.
          update_plateau_schedulers: control whether ``ReduceLROnPlateau`` or non-plateau schedulers get updated.
              This is used so non-plateau schedulers can be updated before running validation. Checkpoints are
              commonly saved during validation, however, on-plateau schedulers might monitor a validation metric
              so they have to be updated separately.
  
      """
      trainer = self.trainer
  
      if (
          not trainer.lr_scheduler_configs
          or not trainer.lightning_module.automatic_optimization
      ):
          return
  
      for config in trainer.lr_scheduler_configs:
          if update_plateau_schedulers ^ config.reduce_on_plateau:
              continue
  
          current_idx = (
              self.batch_idx
              if interval == "step"
              else trainer.current_epoch
          )
          current_idx += (
              1  # account for both batch and epoch starts from 0
          )
          # Take step if call to update_learning_rates matches the interval key and
          # the current step modulo the schedulers frequency is zero
          if (
              config.interval == interval
              and current_idx % config.frequency == 0
          ):
              monitor_val = None
              if config.reduce_on_plateau:
                  monitor_key = config.monitor
                  assert monitor_key is not None
                  monitor_val = self._get_monitor_value(monitor_key)
                  if monitor_val is None:
                      if config.strict:
                          avail_metrics = list(trainer.callback_metrics)
                          raise MisconfigurationException(
                              f"ReduceLROnPlateau conditioned on metric {monitor_key}"
                              f" which is not available. Available metrics are: {avail_metrics}."
                              " Condition can be set using `monitor` key in lr scheduler dict"
                          )
                      rank_zero_warn(
                          f"ReduceLROnPlateau conditioned on metric {monitor_key}"
                          " which is not available but strict is set to `False`."
                          " Skipping learning rate update.",
                          category=RuntimeWarning,
                      )
                      continue
  
              self.scheduler_progress.increment_ready()
  
              # update LR
              call._call_lightning_module_hook(
                  trainer,
                  "lr_scheduler_step",
                  config.scheduler,
                  monitor_val,
              )
              self.scheduler_progress.increment_completed()
  
imports: import math
  from collections import OrderedDict
  from typing import Any, Dict, Optional, Union
  from typing_extensions import override
  import lightning.pytorch
  from lightning.pytorch import loops
  from lightning.pytorch.loops.fetchers import _DataFetcher, _DataLoaderIterDataFetcher
  from lightning.pytorch.loops.optimization import _AutomaticOptimization, _ManualOptimization
  from lightning.pytorch.loops.optimization.automatic import _OUTPUTS_TYPE
  from lightning.pytorch.loops.optimization.manual import _OUTPUTS_TYPE
  from lightning.pytorch.loops.progress import _BatchProgress, _SchedulerProgress
  from lightning.pytorch.loops.utilities import _is_max_limit_reached
  from lightning.pytorch.trainer import call
  from lightning.pytorch.trainer.connectors.logger_connector.result import _ResultCollection
  from lightning.pytorch.trainer.states import RunningStage, TrainerFn
  from lightning.pytorch.utilities.exceptions import MisconfigurationException, SIGTERMException
  from lightning.pytorch.utilities.rank_zero import WarningCache, rank_zero_warn
  from lightning.pytorch.utilities.signature_utils import is_param_in_hook_signature
label_desc: Use image node_id 22 for calling the _TrainingEpochLoop obj's underlying member method code with example usage: obj._update_learning_rates(interval, update_plateau_schedulers) without return types