class_docstr: Optimizer that implements the Adam algorithm with weight decay.
  
  This is an implementation of the AdamW optimizer described in "Decoupled
  Weight Decay Regularization" by [Loshchilov & Hutter]
  (https://arxiv.org/pdf/1711.05101.pdf).
  
  It computes the update step of `tf.keras.optimizers.Adam` and additionally
  decays the variable. Note that this is different from adding L2
  regularization on the variables to the loss: it regularizes variables with
  large gradients more than L2 regularization would, which was shown to yield
  better training loss and generalization error in the paper above.
  
  For further information see the documentation of the Adam Optimizer.
  
  This optimizer can also be instantiated as
  ```python
  extend_with_decoupled_weight_decay(tf.keras.optimizers.Adam,
                                     weight_decay=weight_decay)
  ```
  
  Note: when applying a decay to the learning rate, be sure to manually apply
  the decay to the `weight_decay` as well. For example:
  
  ```python
  step = tf.Variable(0, trainable=False)
  schedule = tf.optimizers.schedules.PiecewiseConstantDecay(
      [10000, 15000], [1e-0, 1e-1, 1e-2])
  # lr and wd can be a function or a tensor
  lr = 1e-1 * schedule(step)
  wd = lambda: 1e-4 * schedule(step)
  
  # ...
  
  optimizer = tfa.optimizers.AdamW(learning_rate=lr, weight_decay=wd)
  ```
docstr: Construct a new AdamW optimizer.
  
  For further information see the documentation of the Adam Optimizer.
  
  Args:
      weight_decay: A Tensor or a floating point value. The weight decay.
      learning_rate: A Tensor or a floating point value. The learning
          rate.
      beta_1: A float value or a constant float tensor. The exponential
          decay rate for the 1st moment estimates.
      beta_2: A float value or a constant float tensor. The exponential
          decay rate for the 2nd moment estimates.
      epsilon: A small constant for numerical stability. This epsilon is
          "epsilon hat" in the Kingma and Ba paper (in the formula just
          before Section 2.1), not the epsilon in Algorithm 1 of the
          paper.
      amsgrad: boolean. Whether to apply AMSGrad variant of this
          algorithm from the paper "On the Convergence of Adam and
          beyond".
      name: Optional name for the operations created when applying
          gradients. Defaults to "AdamW".
      **kwargs: keyword arguments. Allowed to be {`clipnorm`, `clipvalue`,
          `lr`, `decay`, `exclude_from_weight_decay`}. `clipnorm` is clip
          gradients by norm; `clipvalue` is clip gradients by value.
          `decay` is included for backward compatibility to allow time
          inverse decay of learning rate. `lr` is included for backward
          compatibility, recommended to use `learning_rate` instead.
          `exclude_from_weight_decay` accepts list of regex patterns of
          variables excluded from weight decay.
docstr_tok: ["Construct","a","new","AdamW","optimizer",".","For","further","information","see","the","documentation","of","the","Adam","Optimizer",".","Args",":","weight_decay",":","A","Tensor","or","a","floating","point","value",".","The","weight","decay",".","learning_rate",":","A","Tensor","or","a","floating","point","value",".","The","learning","rate",".","beta_1",":","A","float","value","or","a","constant","float","tensor",".","The","exponential","decay","rate","for","the","1st","moment","estimates",".","beta_2",":","A","float","value","or","a","constant","float","tensor",".","The","exponential","decay","rate","for","the","2nd","moment","estimates",".","epsilon",":","A","small","constant","for","numerical","stability",".","This","epsilon","is","``","epsilon","hat","''","in","the","Kingma","and","Ba","paper","(","in","the","formula","just","before","Section","2.1",")",",","not","the","epsilon","in","Algorithm","1","of","the","paper",".","amsgrad",":","boolean",".","Whether","to","apply","AMSGrad","variant","of","this","algorithm","from","the","paper","``","On","the","Convergence","of","Adam","and","beyond","''",".","name",":","Optional","name","for","the","operations","created","when","applying","gradients",".","Defaults","to","``","AdamW","''",".","*","*","kwargs",":","keyword","arguments",".","Allowed","to","be","{","`","clipnorm","`",",","`","clipvalue","`",",","`","lr","`",",","`","decay","`",",","`","exclude_from_weight_decay","`","}",".","`","clipnorm","`","is","clip","gradients","by","norm",";","`","clipvalue","`","is","clip","gradients","by","value",".","`","decay","`","is","included","for","backward","compatibility","to","allow","time","inverse","decay","of","learning","rate",".","`","lr","`","is","included","for","backward","compatibility",",","recommended","to","use","`","learning_rate","`","instead",".","`","exclude_from_weight_decay","`","accepts","list","of","regex","patterns","of","variables","excluded","from","weight","decay","."]
code: def __init__(
      self,
      weight_decay: Union[FloatTensorLike, Callable],
      learning_rate: Union[FloatTensorLike, Callable] = 0.001,
      beta_1: Union[FloatTensorLike, Callable] = 0.9,
      beta_2: Union[FloatTensorLike, Callable] = 0.999,
      epsilon: FloatTensorLike = 1e-07,
      amsgrad: bool = False,
      name: str = "AdamW",
      **kwargs,
  ):
      """Construct a new AdamW optimizer.
  
      For further information see the documentation of the Adam Optimizer.
  
      Args:
          weight_decay: A Tensor or a floating point value. The weight decay.
          learning_rate: A Tensor or a floating point value. The learning
              rate.
          beta_1: A float value or a constant float tensor. The exponential
              decay rate for the 1st moment estimates.
          beta_2: A float value or a constant float tensor. The exponential
              decay rate for the 2nd moment estimates.
          epsilon: A small constant for numerical stability. This epsilon is
              "epsilon hat" in the Kingma and Ba paper (in the formula just
              before Section 2.1), not the epsilon in Algorithm 1 of the
              paper.
          amsgrad: boolean. Whether to apply AMSGrad variant of this
              algorithm from the paper "On the Convergence of Adam and
              beyond".
          name: Optional name for the operations created when applying
              gradients. Defaults to "AdamW".
          **kwargs: keyword arguments. Allowed to be {`clipnorm`, `clipvalue`,
              `lr`, `decay`, `exclude_from_weight_decay`}. `clipnorm` is clip
              gradients by norm; `clipvalue` is clip gradients by value.
              `decay` is included for backward compatibility to allow time
              inverse decay of learning rate. `lr` is included for backward
              compatibility, recommended to use `learning_rate` instead.
              `exclude_from_weight_decay` accepts list of regex patterns of
              variables excluded from weight decay.
      """
      super().__init__(
          weight_decay,
          learning_rate=learning_rate,
          beta_1=beta_1,
          beta_2=beta_2,
          epsilon=epsilon,
          amsgrad=amsgrad,
          name=name,
          **kwargs,
      )
  
imports: import importlib
  import tensorflow
  from tensorflow_addons.utils.types import FloatTensorLike
  from tensorflow_addons.optimizers.utils import is_variable_matched_by_regexes
  from typeguard import typechecked
  from typing import Union, Callable, Type, Optional, List
label_desc: Use image node_id 1 to create a new AdamW object from inherited base classes: DecoupledWeightDecayExtension, ADAM_CLASS with example: obj = AdamW(weight_decay, learning_rate, beta_1, beta_2, epsilon, amsgrad, name)