def testFullUpdate(self, use_locking):
    """Tests full update of the target variables from the source variables."""
    target_variables = [
        tf.Variable(tf.random_normal(shape=[1, 2])),
        tf.Variable(tf.random_normal(shape=[3, 4])),
    ]
    source_variables = [
        tf.Variable(tf.random_normal(shape=[1, 2])),
        tf.Variable(tf.random_normal(shape=[3, 4])),
    ]
    updated = target_update_ops.update_target_variables(
        target_variables, source_variables, use_locking=use_locking)

    # Collect all the tensors and ops we want to evaluate in the session.
    vars_ops = target_variables + source_variables

    with self.test_session() as sess:
      sess.run(tf.global_variables_initializer())
      sess.run(updated)
      results = sess.run(vars_ops)
      # First target variable is updated with first source variable.
      self.assertAllClose(results[0], results[2])
      # Second target variable is updated with second source variable.
      self.assertAllClose(results[1], results[3])
Tests full update of the target variables from the source variables.
trfl/target_update_ops_test.py