class_docstr: Optimizer that implements the YellowFin algorithm.
  
  See [Zhang et. al., 2017](https://arxiv.org/abs/1706.03471) for details.
docstr: Estimate of gradient Variance.
  
  Returns:
    C_t ops.
docstr_tok: ["Estimate","of","gradient","Variance",".","Returns",":","C_t","ops","."]
code: def _grad_variance(self):
      """Estimate of gradient Variance.
  
      Returns:
        C_t ops.
      """
      grad_var_ops = []
      tensor_to_avg = []
      for t, g in zip(self._vars, self._grad):
          if isinstance(g, tf.IndexedSlices):
              tensor_to_avg.append(
                  tf.reshape(
                      tf.unsorted_segment_sum(
                          g.values, g.indices, g.dense_shape[0]
                      ),
                      shape=t.get_shape(),
                  )
              )
          else:
              tensor_to_avg.append(g)
      avg_op = self._moving_averager.apply(tensor_to_avg)
      grad_var_ops.append(avg_op)
      with tf.control_dependencies([avg_op]):
          self._grad_avg = [
              self._moving_averager.average(val)
              for val in tensor_to_avg
          ]
          self._grad_avg_squared = [
              tf.square(val) for val in self._grad_avg
          ]
  
      # Compute Variance
      self._grad_var = tf.maximum(
          tf.constant(1e-6, dtype=self._grad_norm_squared_avg.dtype),
          self._grad_norm_squared_avg
          - tf.add_n(
              [tf.reduce_sum(val) for val in self._grad_avg_squared]
          ),
      )
      if self._sparsity_debias:
          self._grad_var *= self._sparsity_avg
      return grad_var_ops
  
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 3 for calling the YellowFinOptimizer obj's underlying member method code with example usage: obj._grad_variance() and returns: grad_var_ops