class_docstr: Optimizer that implements the YellowFin algorithm.
  
  See [Zhang et. al., 2017](https://arxiv.org/abs/1706.03471) for details.
docstr: Prepare Variables for YellowFin.
  
  Returns:
    Grad**2, Norm, Norm**2, Mean(Norm**2) ops
docstr_tok: ["Prepare","Variables","for","YellowFin",".","Returns",":","Grad","*","*","2",",","Norm",",","Norm","*","*","2",",","Mean","(","Norm","*","*","2",")","ops"]
code: def _prepare_variables(self):
      """Prepare Variables for YellowFin.
  
      Returns:
        Grad**2, Norm, Norm**2, Mean(Norm**2) ops
      """
      self._moving_averager = tf.train.ExponentialMovingAverage(
          decay=self._beta, zero_debias=self._zero_debias
      )
      # assert self._grad is not None and len(self._grad) > 0
      # List for the returned Operations
      prepare_variables_op = []
  
      # Get per var g**2 and norm**2
      self._grad_squared = []
      self._grad_norm_squared = []
  
      # Gradient squared
      for v, g in zip(self._vars, self._grad):
          if g is None:
              continue
          with tf.colocate_with(v):
              self._grad_squared.append(tf.square(g))
  
      # Norm squared.
      self._grad_norm_squared = [
          tf.reduce_sum(g_sq) for g_sq in self._grad_squared
      ]
  
      if self._sparsity_debias:
          avg_op_sparsity = self._grad_sparsity()
          prepare_variables_op.append(avg_op_sparsity)
  
      # The following running average on squared norm of gradient
      # is shared by grad_var and dist_to_opt
      avg_op = self._moving_averager.apply(self._grad_norm_squared)
  
      with tf.control_dependencies([avg_op]):
          self._grad_norm_squared_avg = [
              self._moving_averager.average(val)
              for val in self._grad_norm_squared
          ]
          self._grad_norm_squared = tf.add_n(self._grad_norm_squared)
          self._grad_norm_squared_avg = tf.add_n(
              self._grad_norm_squared_avg
          )
  
      prepare_variables_op.append(avg_op)
      return tf.group(*prepare_variables_op)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow.compat.v1
label_desc: Use image node_id 6 for calling the YellowFinOptimizer obj's underlying member method code with example usage: obj._prepare_variables() and returns: tf