'Prepare Variables for YellowFin.
Returns:
Grad**2, Norm, Norm**2, Mean(Norm**2) ops'

def _prepare_variables(self):

    self._moving_averager = tf.train.ExponentialMovingAverage(decay=self._beta, zero_debias=self._zero_debias)
    assert self._grad
    prepare_variables_op = []
    self._grad_squared = []
    self._grad_norm_squared = []
    for (v, g) in zip(self._vars, self._grad):
        if (g is None):
            continue
        with ops.colocate_with(v):
            self._grad_squared.append(tf.square(g))
    self._grad_norm_squared = [tf.reduce_sum(g_sq) for g_sq in self._grad_squared]
    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)
