'Compute the mean per component variance.
Use a moving average to estimate the required moments.'

def compute_tensor_variance(self, t):

    t_sq = tf.reduce_mean(tf.square(t))
    self.maintain_ema_ops.append(self.ema.apply([t, t_sq]))
    variance_estimator = (self.ema.average(t_sq) - tf.reduce_mean(tf.square(self.ema.average(t))))
    return variance_estimator
