class_docstr: A special loop implementing what is known in Lightning as Manual Optimization where the optimization happens
  entirely in the :meth:`~lightning.pytorch.core.LightningModule.training_step` and therefore the user is responsible
  for back-propagating gradients and making calls to the optimizers.
  
  This loop is a trivial case because it performs only a single iteration (calling directly into the module's
  :meth:`~lightning.pytorch.core.LightningModule.training_step`) and passing through the output(s).
class_docstr_tok: ["A","special","loop","implementing","what","is","known","in","Lightning","as","Manual","Optimization","where","the","optimization","happens","entirely","in","the",":","meth",":","`","~lightning.pytorch.core.LightningModule.training_step","`","and","therefore","the","user","is","responsible","for","back-propagating","gradients","and","making","calls","to","the","optimizers",".","This","loop","is","a","trivial","case","because","it","performs","only","a","single","iteration","(","calling","directly","into","the","module's",":","meth",":","`","~lightning.pytorch.core.LightningModule.training_step","`",")","and","passing","through","the","output","(","s",")","."]
docstr: Performs the training step for manual optimization.
  
  Args:
      kwargs: The kwargs passed down to the hooks.
docstr_tok: ["Performs","the","training","step","for","manual","optimization",".","Args",":","kwargs",":","The","kwargs","passed","down","to","the","hooks","."]
code: def advance(self, kwargs: OrderedDict) -> None:
      """Performs the training step for manual optimization.
  
      Args:
          kwargs: The kwargs passed down to the hooks.
  
      """
      trainer = self.trainer
  
      # manually capture logged metrics
      training_step_output = call._call_strategy_hook(
          trainer, "training_step", *kwargs.values()
      )
      del kwargs  # release the batch from memory
      self.trainer.strategy.post_training_step()  # unused hook - call anyway for backward compatibility
      result = self.output_result_cls.from_training_step_output(
          training_step_output
      )
  
      self._output = result.asdict()
  
imports: from collections import OrderedDict
  from contextlib import suppress
  from dataclasses import dataclass, field
  from typing import Any, Dict
  from torch import Tensor
  from typing_extensions import override
  import lightning.pytorch
  from lightning.pytorch.core.optimizer import do_nothing_closure
  from lightning.pytorch.loops import _Loop
  from lightning.pytorch.loops.optimization.closure import OutputResult
  from lightning.pytorch.loops.progress import _Progress, _ReadyCompletedTracker
  from lightning.pytorch.trainer import call
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.types import STEP_OUTPUT
label_desc: Use image node_id 4 for calling the _ManualOptimization obj's underlying member method code with example usage: obj.advance(kwargs) without return types