code: def __init__(
      self,
      optimizer: types.Optimizer,
      name: str = "AverageOptimizer",
      **kwargs,
  ):
      super().__init__(name, **kwargs)
  
      if isinstance(optimizer, str):
          if (
              hasattr(tf.keras.optimizers, "legacy")
              and KerasLegacyOptimizer
              == tf.keras.optimizers.legacy.Optimizer
          ):
              optimizer = tf.keras.optimizers.get(
                  optimizer, use_legacy_optimizer=True
              )
          else:
              optimizer = tf.keras.optimizers.get(optimizer)
  
      if not isinstance(optimizer, KerasLegacyOptimizer):
          raise TypeError(
              "optimizer is not an object of tf.keras.optimizers.legacy.Optimizer "
          )
  
      self._optimizer = optimizer
      self._track_trackable(self._optimizer, "awg_optimizer")
  
imports: import abc
  import warnings
  import tensorflow
  from tensorflow_addons.optimizers import KerasLegacyOptimizer
  from tensorflow_addons.utils import types
  from typeguard import typechecked
label_desc: Use image node_id 1 to create a new AveragedOptimizerWrapper object from inherited base classes: KerasLegacyOptimizer with example: obj = AveragedOptimizerWrapper(optimizer, name)