code: def get_target_ops(variables, target_variables, tau=None):
      """Get target variables update operations.
  
      In RL algorithms we often update target network every n
      steps. This function returns the tf.Operation for updating
      target variables (denoted by target_var) from variables
      (denote by var) with fraction tau. In other words, each time
      we want to keep tau of the var and add (1 - tau) of target_var
      to var.
  
      Args:
          variables (list[tf.Variable]): Soure variables for update.
          target_variables (list[tf.Variable]): Target variables to
              be updated.
          tau (float): Fraction to update. Set it to be None for
              hard-update.
  
      Returns:
          tf.Operation: Operation for updating the target variables.
      """
      update_ops = []
      init_ops = []
      assert len(variables) == len(target_variables)
      for var, target_var in zip(variables, target_variables):
          init_ops.append(tf.compat.v1.assign(target_var, var))
  
          if tau is not None:
              update_ops.append(
                  tf.compat.v1.assign(
                      target_var, tau * var + (1.0 - tau) * target_var
                  )
              )
  
      if tau is not None:
          return init_ops, update_ops
      else:
          return init_ops
  
imports: import collections
  import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: get_target_ops(variables, target_variables, tau) and returns: init_ops,  update_ops, init_ops