9283f13d67bcee7956ea7d5e9a9ca0a1a08d6c1d,tf_agents/utils/common_test.py,SoftVariablesUpdateTest,testUpdateOnlyTargetVariables,#SoftVariablesUpdateTest#Any#,76

Before Change


      source_vars = tf.contrib.framework.get_model_variables("source")
      target_vars = tf.contrib.framework.get_model_variables("target")
      update_op = common.soft_variables_update(source_vars, target_vars, tau)
      with self.cached_session(graph=g) as sess:
        tf.global_variables_initializer().run()
        v_s, v_t = sess.run([source_vars, target_vars])
        sess.run(update_op)
        new_v_s, new_v_t = sess.run([source_vars, target_vars])
        for i_v_s, i_v_t, n_v_s, n_v_t in zip(v_s, v_t, new_v_s, new_v_t):
          // Source variables don"t change
          self.assertAllClose(n_v_s, i_v_s)
          // Target variables are updated
          self.assertAllClose(n_v_t, tau*i_v_s + (1-tau)*i_v_t)

  @parameterized.parameters(0.0, 0.5, 1.0)
  def testShuffleOrderVariables(self, tau):
    with tf.Graph().as_default() as g:
      inputs = tf.constant([[1, 2], [3, 4]], dtype=tf.float32)

After Change


    v_s, v_t = self.evaluate([source_vars, target_vars])
    self.evaluate(update_op)
    new_v_s, new_v_t = self.evaluate([source_vars, target_vars])
    for i_v_s, i_v_t, n_v_s, n_v_t in zip(v_s, v_t, new_v_s, new_v_t):
      // Source variables don"t change
      self.assertAllClose(n_v_s, i_v_s)
      // Target variables are updated
      self.assertAllClose(n_v_t, tau*i_v_s + (1-tau)*i_v_t)

  @parameterized.parameters(0.0, 0.5, 1.0)
  def testShuffleOrderVariables(self, tau):
    inputs = tf.constant([[1, 2], [3, 4]], dtype=tf.float32)
    tf.contrib.layers.fully_connected(inputs, 2, scope="source")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: tensorflow/agents
Commit Name: 9283f13d67bcee7956ea7d5e9a9ca0a1a08d6c1d
Time: 2019-02-04
Author: gjn@google.com
File Name: tf_agents/utils/common_test.py
Class Name: SoftVariablesUpdateTest
Method Name: testUpdateOnlyTargetVariables


Project Name: tensorflow/agents
Commit Name: 9283f13d67bcee7956ea7d5e9a9ca0a1a08d6c1d
Time: 2019-02-04
Author: gjn@google.com
File Name: tf_agents/replay_buffers/tf_uniform_replay_buffer_test.py
Class Name: TFUniformReplayBufferTest
Method Name: testGatherAll


Project Name: tensorflow/agents
Commit Name: 9283f13d67bcee7956ea7d5e9a9ca0a1a08d6c1d
Time: 2019-02-04
Author: gjn@google.com
File Name: tf_agents/utils/common_test.py
Class Name: SoftVariablesUpdateTest
Method Name: testShuffleOrderVariables