class_docstr: Tree aggregator to compute accumulated noise in private algorithms.
  
  This class implements the tree aggregation algorithm for noise values to
  efficiently privatize streaming algorithms based on Dwork et al. (2010)
  https://dl.acm.org/doi/pdf/10.1145/1806689.1806787. A buffer at the scale of
  tree depth is maintained and updated when a new conceptual leaf node arrives.
  
  Example usage:
    random_generator = GaussianNoiseGenerator(...)
    tree_aggregator = TreeAggregator(random_generator)
    state = tree_aggregator.init_state()
    for leaf_node_idx in range(total_steps):
      assert leaf_node_idx == get_step_idx(state))
      noise, state = tree_aggregator.get_cumsum_and_update(state)
  
  Attributes:
    value_generator: A `ValueGenerator` or a no-arg function to generate a noise
      value for each tree node.
class_docstr_tok: ["Tree","aggregator","to","compute","accumulated","noise","in","private","algorithms",".","This","class","implements","the","tree","aggregation","algorithm","for","noise","values","to","efficiently","privatize","streaming","algorithms","based","on","Dwork","et","al",".","(","2010",")","https",":","\/\/dl.acm.org\/doi\/pdf\/10.1145\/1806689.1806787",".","A","buffer","at","the","scale","of","tree","depth","is","maintained","and","updated","when","a","new","conceptual","leaf","node","arrives",".","Example","usage",":","random_generator","=","GaussianNoiseGenerator","(","...",")","tree_aggregator","=","TreeAggregator","(","random_generator",")","state","=","tree_aggregator.init_state","(",")","for","leaf_node_idx","in","range","(","total_steps",")",":","assert","leaf_node_idx","==","get_step_idx","(","state",")",")","noise",",","state","=","tree_aggregator.get_cumsum_and_update","(","state",")","Attributes",":","value_generator",":","A","`","ValueGenerator","`","or","a","no-arg","function","to","generate","a","noise","value","for","each","tree","node","."]
code: def _get_cumsum(
      self, level_buffer: Collection[tf.Tensor]
  ) -> tf.Tensor:
      return tf.nest.map_structure(
          lambda x: tf.reduce_sum(x, axis=0), level_buffer
      )
  
imports: import abc
  import collections
  from typing import Any, Callable, Collection, NamedTuple, Optional, Tuple, Union
  import tensorflow
label_desc: Use image node_id 5 for calling the TreeAggregator obj's underlying member method code with example usage: obj._get_cumsum(level_buffer) and returns: tf