'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 __init__(self, opt, func):

    def f(v):
        t = func(v)
        if (t is None):
            return t
        return tf.assign(v, t, use_locking=False).op
    super(VariableAssignmentOptimizer, self).__init__(opt, f)
