class_docstr: This class allows to extend optimizers with decoupled weight decay.
  
  It implements the decoupled weight decay described by [Loshchilov & Hutter]
  (https://arxiv.org/pdf/1711.05101.pdf), in which the weight decay is
  decoupled from the optimization steps w.r.t. to the loss function.
  For SGD variants, this simplifies hyperparameter search since it decouples
  the settings of weight decay and learning rate.
  For adaptive gradient algorithms, 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.
  
  This class alone is not an optimizer but rather extends existing
  optimizers with decoupled weight decay. We explicitly define the two
  examples used in the above paper (SGDW and AdamW), but in general this can
  extend any OptimizerX class by using
      `ExtendedCls = extend_with_decoupled_weight_decay(OptimizerX)`.
  Weight decay can then be set when instantiating the optimizer:
      `optimizerX = ExtendedCls(weight_decay=0.001, learning_rate=0.001)`.
  In order for it to work, it must be the first class the Optimizer with
  weight decay inherits from, e.g.
  
  ```python
  class AdamW(DecoupledWeightDecayExtension, tf.keras.optimizers.Adam):
    def __init__(self, weight_decay, *args, **kwargs):
      super(AdamW, self).__init__(weight_decay, *args, **kwargs).
  ```
  
  Note: this extension decays weights BEFORE applying the update based
  on the gradient, i.e. this extension only has the desired behaviour for
  optimizers which do not depend on the value of'var' in the update step!
  
  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: Whether to use L2 weight decay for `var`.
docstr_tok: ["Whether","to","use","L2","weight","decay","for","`","var","`","."]
code: def _do_use_weight_decay(self, var):
      """Whether to use L2 weight decay for `var`."""
      if self._decay_var_list is None:
          return True
      return var.ref() in self._decay_var_list
  
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 13 for calling the DecoupledWeightDecayExtension obj's underlying member method code with example usage: obj._do_use_weight_decay(var) and returns: unknown, True