'Initialize a MomentsAccountant.
Args:
total_examples: total number of examples.
moment_orders: the order of moments to keep.'

def __init__(self, total_examples, moment_orders=32):

    assert (total_examples > 0)
    self._total_examples = total_examples
    self._moment_orders = (moment_orders if isinstance(moment_orders, (list, tuple)) else range(1, (moment_orders + 1)))
    self._max_moment_order = max(self._moment_orders)
    assert (self._max_moment_order < 100), 'The    moment    order    is    too    large.'
    self._log_moments = [tf.Variable(numpy.float64(0.0), trainable=False, name=('log_moments-%d' % moment_order)) for moment_order in self._moment_orders]
