class_docstr: Optimizer that implements the YellowFin algorithm.
  
  Implemented as a wrapper around tf.train.MomentumOptimizer
class_docstr_tok: ["Optimizer","that","implements","the","YellowFin","algorithm",".","Implemented","as","a","wrapper","around","tf.train.MomentumOptimizer"]
code: def grad_variance(self):
      grad_var_ops = []
      tensor_to_avg = []
      for t, g in zip(self._tvars, self._grads):
          if isinstance(g, ops.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
          ]
      self._grad_var = tf.maximum(
          tf.constant(EPS, 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 numpy
  import delta.compat
  from tensorflow.python.framework import ops
label_desc: Use image node_id 3 for calling the YFOptimizer obj's underlying member method code with example usage: obj.grad_variance() and returns: grad_var_ops