code: def periodic_target_update(
      target_variables,
      source_variables,
      update_period,
      tau=1.0,
      use_locking=False,
      counter=None,
      name="periodic_target_update",
  ):
      """Returns an op to periodically update a list of target variables.
  
      The `update_target_variables` op is executed every `update_period`
      executions of the `periodic_target_update` op.
  
      The update rule is:
      `target_variable = (1 - tau) * target_variable + tau * source_variable`.
  
      Args:
        target_variables: a list of the variables to be updated.
        source_variables: a list of the variables used for the update.
        update_period: inverse frequency with which to apply the update.
        tau: weight used to gate the update. The permitted range is 0 < tau <= 1,
          with small tau representing an incremental update, and tau == 1
          representing a full update (that is, a straight copy).
        use_locking: use `tf.variable.Assign`'s locking option when assigning
          source variable values to target variables.
        counter: an optional tensorflow variable to use as a counter relative to
          `update_period`, which be passed to `periodic_ops.periodically`. See
          description in `periodic_ops.periodically` for details.
        name: sets the `name_scope` for this op.
  
      Returns:
        An op that periodically updates `target_variables` with `source_variables`.
      """
  
      def update_op():
          return update_target_variables(
              target_variables, source_variables, tau, use_locking
          )
  
      with tf.name_scope(
          name, values=target_variables + source_variables
      ):
          return periodic_ops.periodically(
              update_op, update_period, counter=counter
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow.compat.v1
  from trfl import periodic_ops
label_desc: Use image node_id 2 for calling a global function with example usage: periodic_target_update(target_variables, source_variables, update_period, tau, use_locking, counter, name) and returns: update_target_variables, periodic_ops