class_docstr: `DPQuery` for tree aggregation queries with adaptive clipping.
  
  The implementation is based on tree aggregation noise for cumulative sum in
  "Practical and Private (Deep) Learning without Sampling or Shuffling"
  (https://arxiv.org/abs/2103.00039) and quantile-based adaptive clipping in
  "Differentially Private Learning with Adaptive Clipping"
  (https://arxiv.org/abs/1905.03871).
  
  The quantile value will be continuously estimated, but the clip norm is only
  updated when `reset_state` is called, and the tree state will be reset. This
  will force the clip norm (and corresponding stddev) in a tree unchanged.
class_docstr_tok: ["`","DPQuery","`","for","tree","aggregation","queries","with","adaptive","clipping",".","The","implementation","is","based","on","tree","aggregation","noise","for","cumulative","sum","in","''","Practical","and","Private","(","Deep",")","Learning","without","Sampling","or","Shuffling","''","(","https",":","\/\/arxiv.org\/abs\/2103.00039",")","and","quantile-based","adaptive","clipping","in","''","Differentially","Private","Learning","with","Adaptive","Clipping","''","(","https",":","\/\/arxiv.org\/abs\/1905.03871",")",".","The","quantile","value","will","be","continuously","estimated",",","but","the","clip","norm","is","only","updated","when","`","reset_state","`","is","called",",","and","the","tree","state","will","be","reset",".","This","will","force","the","clip","norm","(","and","corresponding","stddev",")","in","a","tree","unchanged","."]
docstr: Returns state after resetting the tree and updating the clip norm.
  
  This function will be used in `restart_query.RestartQuery` after calling
  `get_noised_result` when the restarting condition is met. The clip norm (
  and corresponding noise stddev) for the tree aggregated sum query is only
  updated from the quantile-based estimation when `reset_state` is called.
  
  Args:
    noised_results: Noised cumulative sum returned by `get_noised_result`.
    global_state: Updated global state returned by `get_noised_result`, which
      records noise for the conceptual cumulative sum of the current leaf
      node, and tree state for the next conceptual cumulative sum.
  
  Returns:
    New global state with restarted tree state, and new clip norm.
docstr_tok: ["Returns","state","after","resetting","the","tree","and","updating","the","clip","norm",".","This","function","will","be","used","in","`","restart_query.RestartQuery","`","after","calling","`","get_noised_result","`","when","the","restarting","condition","is","met",".","The","clip","norm","(","and","corresponding","noise","stddev",")","for","the","tree","aggregated","sum","query","is","only","updated","from","the","quantile-based","estimation","when","`","reset_state","`","is","called",".","Args",":","noised_results",":","Noised","cumulative","sum","returned","by","`","get_noised_result","`",".","global_state",":","Updated","global","state","returned","by","`","get_noised_result","`",",","which","records","noise","for","the","conceptual","cumulative","sum","of","the","current","leaf","node",",","and","tree","state","for","the","next","conceptual","cumulative","sum",".","Returns",":","New","global","state","with","restarted","tree","state",",","and","new","clip","norm","."]
code: def reset_state(self, noised_results, global_state):
      """Returns state after resetting the tree and updating the clip norm.
  
      This function will be used in `restart_query.RestartQuery` after calling
      `get_noised_result` when the restarting condition is met. The clip norm (
      and corresponding noise stddev) for the tree aggregated sum query is only
      updated from the quantile-based estimation when `reset_state` is called.
  
      Args:
        noised_results: Noised cumulative sum returned by `get_noised_result`.
        global_state: Updated global state returned by `get_noised_result`, which
          records noise for the conceptual cumulative sum of the current leaf
          node, and tree state for the next conceptual cumulative sum.
  
      Returns:
        New global state with restarted tree state, and new clip norm.
      """
      new_l2_norm_clip = tf.math.maximum(
          global_state.quantile_estimator_state.current_estimate, 0.0
      )
      new_sum_stddev = new_l2_norm_clip * global_state.noise_multiplier
      sum_state = self._sum_query.reset_l2_clip_gaussian_noise(
          global_state.sum_state,
          clip_norm=new_l2_norm_clip,
          stddev=new_sum_stddev,
      )
      sum_state = self._sum_query.reset_state(noised_results, sum_state)
      quantile_estimator_state = (
          self._quantile_estimator_query.reset_state(
              noised_results, global_state.quantile_estimator_state
          )
      )
  
      return global_state._replace(
          sum_state=sum_state,
          quantile_estimator_state=quantile_estimator_state,
      )
  
file_path: privacy/tensorflow_privacy/privacy/dp_query/quantile_adaptive_clip_tree_query.py
imports: import collections
  import dp_accounting
  import tensorflow
  from tensorflow_privacy.privacy.dp_query import dp_query
  from tensorflow_privacy.privacy.dp_query import quantile_estimator_query
  from tensorflow_privacy.privacy.dp_query import tree_aggregation_query
label_desc: Use image node_id 7 for calling the QAdaClipTreeResSumQuery obj's underlying member method code with example usage: obj.reset_state(noised_results, global_state) and returns: global_state