def testIncrementalUpdate(self, use_locking):
    """Tests incremental update of the target variables."""
    target_variables = [tf.Variable(tf.random_normal(shape=[1, 2]))]
    source_variables = [tf.Variable(tf.random_normal(shape=[1, 2]))]
    updated = target_update_ops.update_target_variables(
        target_variables, source_variables, tau=0.1, use_locking=use_locking)

    with self.test_session() as sess:
      sess.run(tf.global_variables_initializer())
      before_assign = sess.run(target_variables[0])
      sess.run(updated)
      results = sess.run([target_variables[0], source_variables[0]])
      self.assertAllClose(results[0], 0.1 * results[1] + 0.9 * before_assign)
Tests incremental update of the target variables.
trfl/target_update_ops_test.py