class_docstr: ```
  Adam enables L2 weight decay and clip_by_global_norm on gradients. Just adding the square of the weights to the
  loss function is *not* the correct way of using L2 regularization/weight decay with Adam, since that will interact
  with the m and v parameters in strange ways as shown in
  `Decoupled Weight Decay Regularization <https://arxiv.org/abs/1711.05101>`__.
  Instead we want ot decay the weights in a manner that doesn't interact with the m/v parameters. This is equivalent
  to adding the square of the weights to the loss with plain (non-momentum) SGD.
  Args:
      learning_rate (:obj:`Union[float, tf.keras.optimizers.schedules.LearningRateSchedule]`, `optional`, defaults to 1e-3):
          The learning rate to use or a schedule.
      beta_1 (:obj:`float`, `optional`, defaults to 0.9):
          The beta1 parameter in Adam, which is the exponential decay rate for the 1st momentum estimates.
      beta_2 (:obj:`float`, `optional`, defaults to 0.999):
          The beta2 parameter in Adam, which is the exponential decay rate for the 2nd momentum estimates.
      epsilon (:obj:`float`, `optional`, defaults to 1e-7):
          The epsilon paramenter in Adam, which is a small constant for numerical stability.
      amsgrad (:obj:`bool`, `optional`, default to `False`):
          Wheter to apply AMSGrad varient of this algorithm or not, see
          `On the Convergence of Adam and Beyond <https://arxiv.org/abs/1904.09237>`__.
      weight_decay_rate (:obj:`float`, `optional`, defaults to 0):
          The weight decay to apply.
      include_in_weight_decay (:obj:`List[str]`, `optional`):
          List of the parameter names (or re patterns) to apply weight decay to. If none is passed, weight decay is
          applied to all parameters by default (unless they are in :obj:`exclude_from_weight_decay`).
      exclude_from_weight_decay (:obj:`List[str]`, `optional`):
          List of the parameter names (or re patterns) to exclude from applying weight decay to. If a
          :obj:`include_in_weight_decay` is passed, the names in it will supersede this list.
      name (:obj:`str`, `optional`, defaults to 'AdamWeightDecay'):
          Optional name for the operations created when applying gradients.
      kwargs:
          Keyward arguments. Allowed to be {``clipnorm``, ``clipvalue``, ``lr``, ``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.
  ```
code: def _decay_weights_op(self, var, learning_rate, apply_state):
      do_decay = self._do_use_weight_decay(var.name)
      if do_decay:
          return var.assign_sub(
              learning_rate
              * var
              * apply_state[(var.device, var.dtype.base_dtype)][
                  "weight_decay_rate"
              ],
              use_locking=self._use_locking,
          )
      return tf.no_op()
  
imports: import re
  from typing import Callable, List, Optional, Union
  import tensorflow
  from packaging import version
label_desc: Use image node_id 4 for calling the AdamWeightDecay obj's underlying member method code with example usage: obj._decay_weights_op(var, learning_rate, apply_state) and returns: tf, var