code: def compute_rdp_tree_restart(
      noise_multiplier: float,
      steps_list: Union[int, Collection[int]],
      orders: Union[float, Collection[float]],
  ) -> Union[float, Collection[float]]:
      """Computes RDP of the Tree Aggregation Protocol for Gaussian Mechanism.
  
      This function implements the accounting when the tree is restarted at every
      epoch. See appendix D of
      "Practical and Private (Deep) Learning without Sampling or Shuffling"
      https://arxiv.org/abs/2103.00039.
  
      Args:
        noise_multiplier: A non-negative float representing the ratio of the
          standard deviation of the Gaussian noise to the l2-sensitivity of a single
          contribution (a leaf node), which is usually set in
          `TreeCumulativeSumQuery` and `TreeResidualSumQuery` from
          `dp_query.tree_aggregation_query`.
        steps_list: A scalar or a list of non-negative intergers representing the
          number of steps per epoch (between two restarts).
        orders: An array (or a scalar) of RDP orders.
  
      Returns:
        The RDPs at all orders. Can be `np.inf`.
      """
      _check_nonnegative(noise_multiplier, "noise_multiplier")
      if noise_multiplier == 0:
          return np.inf
  
      if not steps_list:
          raise ValueError(
              "steps_list must be a non-empty list, or a non-zero scalar, got "
              f"{steps_list}."
          )
  
      if np.isscalar(steps_list):
          steps_list = [steps_list]
  
      for steps in steps_list:
          if steps < 0:
              raise ValueError(
                  f"Steps must be non-negative, got {steps_list}"
              )
  
      if np.isscalar(orders):
          rdp = _compute_rdp_tree_restart(
              noise_multiplier, steps_list, orders
          )
      else:
          rdp = np.array(
              [
                  _compute_rdp_tree_restart(
                      noise_multiplier, steps_list, alpha
                  )
                  for alpha in orders
              ]
          )
  
      return rdp
  
file_path: privacy/tensorflow_privacy/privacy/analysis/tree_aggregation_accountant.py
imports: import functools
  import math
  from typing import Collection, Optional, Union
  import dp_accounting
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: compute_rdp_tree_restart(noise_multiplier, steps_list, orders) and returns: rdp, np