class_docstr: An optimizer which assigns each variable a new value (e.g. clipping,
  quantization) after the gradient update.
class_docstr_tok: ["An","optimizer","which","assigns","each","variable","a","new","value","(","e.g",".","clipping",",","quantization",")","after","the","gradient","update","."]
docstr: Args:
      opt (tf.train.Optimizer):
      func (tf.Variable -> tf.Tensor or None): the new value to be
          assigned to this variable after the gradient update.
docstr_tok: ["Args",":","opt","(","tf.train.Optimizer",")",":","func","(","tf.Variable","-",">","tf.Tensor","or","None",")",":","the","new","value","to","be","assigned","to","this","variable","after","the","gradient","update","."]
code: def __init__(self, opt, func):
      """
      Args:
          opt (tf.train.Optimizer):
          func (tf.Variable -> tf.Tensor or None): the new value to be
              assigned to this variable after the gradient update.
      """
  
      def f(v):
          t = func(v)
          if t is None:
              return t
          return tfv1.assign(v, t, use_locking=False).op
  
      super(VariableAssignmentOptimizer, self).__init__(opt, f)
  
imports: from contextlib import contextmanager
  import tensorflow
  from ..tfutils.common import get_tf_version_tuple
  from ..compat import tfv1
  from ..utils.develop import HIDE_DOC
  from .gradproc import FilterNoneGrad, GradientProcessor
label_desc: Use image node_id 1 to create a new VariableAssignmentOptimizer object from inherited base classes: PostProcessOptimizer with example: obj = VariableAssignmentOptimizer(opt, func)