docstr: FabricOptimizer is a thin wrapper around the :class:`~torch.optim.Optimizer` that delegates the optimizer
  step calls to the strategy.
  
  The underlying wrapped optimizer object can be accessed via the property :attr:`optimizer`.
  
  Args:
      optimizer: The optimizer to wrap
      strategy: Reference to the strategy for handling the optimizer step
docstr_tok: ["FabricOptimizer","is","a","thin","wrapper","around","the",":","class",":","`","~torch.optim.Optimizer","`","that","delegates","the","optimizer","step","calls","to","the","strategy",".","The","underlying","wrapped","optimizer","object","can","be","accessed","via","the","property",":","attr",":","`","optimizer","`",".","Args",":","optimizer",":","The","optimizer","to","wrap","strategy",":","Reference","to","the","strategy","for","handling","the","optimizer","step"]
code: def __init__(
      self,
      optimizer: Optimizer,
      strategy: Strategy,
      callbacks: Optional[List[Callable]] = None,
  ) -> None:
      """FabricOptimizer is a thin wrapper around the :class:`~torch.optim.Optimizer` that delegates the optimizer
      step calls to the strategy.
  
      The underlying wrapped optimizer object can be accessed via the property :attr:`optimizer`.
  
      Args:
          optimizer: The optimizer to wrap
          strategy: Reference to the strategy for handling the optimizer step
  
      """
      self._optimizer = optimizer
      self._strategy = strategy
      self._callbacks = callbacks or []
      # imitate the class of the wrapped object to make isinstance checks work
      self.__class__ = type(
          "Fabric" + optimizer.__class__.__name__,
          (self.__class__, optimizer.__class__),
          {},
      )
  
imports: import inspect
  from functools import wraps
  from typing import Any, Callable, Dict, Generator, Iterator, List, Mapping, Optional, TypeVar, Union, overload
  import torch
  from lightning_utilities.core.apply_func import apply_to_collection
  from torch import Tensor
  from torch import nn
  from torch.nn.modules.module import _IncompatibleKeys
  from torch.optim import Optimizer
  from torch.utils.data import DataLoader
  from typing_extensions import override
  from lightning.fabric.plugins import Precision
  from lightning.fabric.strategies import Strategy
  from lightning.fabric.utilities import move_data_to_device
  from lightning.fabric.utilities.data import _set_sampler_epoch
  from lightning.fabric.utilities.device_dtype_mixin import _DeviceDtypeModuleMixin
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_0
  from lightning.fabric.utilities.types import Optimizable
label_desc: Use image node_id 1 to create a new _FabricOptimizer object  with example: obj = _FabricOptimizer(optimizer, strategy, callbacks)