class_docstr: Tests function period_target_update.
class_docstr_tok: ["Tests","function","period_target_update","."]
docstr: Tests that the simple success case works as expected.
  
  This is an integration test. The periodically and update parts are
  unit-tested in the preceding.
  
  Args:
    use_locking: value for `periodic_target_update`'s `use_locking` argument.
    update_period: how often an update should happen.
docstr_tok: ["Tests","that","the","simple","success","case","works","as","expected",".","This","is","an","integration","test",".","The","periodically","and","update","parts","are","unit-tested","in","the","preceding",".","Args",":","use_locking",":","value","for","`","periodic_target_update","`","'s","`","use_locking","`","argument",".","update_period",":","how","often","an","update","should","happen","."]
code: def testPeriodicTargetUpdate(self, use_locking, update_period):
      """Tests that the simple success case works as expected.
  
      This is an integration test. The periodically and update parts are
      unit-tested in the preceding.
  
      Args:
        use_locking: value for `periodic_target_update`'s `use_locking` argument.
        update_period: how often an update should happen.
      """
      target_variables = [tf.Variable(tf.zeros([1, 2]))]
      source_variables = [tf.Variable(tf.random_normal([1, 2]))]
      increment = tf.ones([1, 2])
  
      update_source_op = tf.assign_add(source_variables[0], increment)
      updated = target_update_ops.periodic_target_update(
          target_variables,
          source_variables,
          update_period=update_period,
          use_locking=use_locking,
      )
  
      with self.test_session() as sess:
          sess.run(tf.global_variables_initializer())
  
          for step in range(3 * update_period):
              sess.run(update_source_op)
              sess.run(updated)
              targets, sources = sess.run(
                  [target_variables, source_variables]
              )
  
              if step % update_period == 0:
                  self.assertAllClose(targets, sources)
              else:
                  self.assertNotAllClose(targets, sources)
  
file_path: trfl/trfl/target_update_ops_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import tensorflow.compat.v1
  from trfl import target_update_ops
label_desc: Use image node_id 1 for calling the PeriodicTargetUpdateTest obj's underlying member method code with example usage: obj.testPeriodicTargetUpdate(use_locking, update_period) without return types