code: def is_data_independent_always_opt_threshold(
      num_teachers, threshold, sigma, orders
  ):
      """Tests whether data-ind bound is always optimal for the threshold mechanism.
  
      Args:
        num_teachers: Number of teachers.
        threshold: The cut-off threshold.
        sigma: Standard deviation of the Gaussian noise.
        orders: An array_like list of Renyi orders.
  
      Returns:
        Boolean array of length |orders| (a scalar if orders is a scalar). True if
        the data-independent bound is always the same as the data-dependent bound.
      """
  
      # Since the data-dependent bound depends only on max(votes), it suffices to
      # check whether the data-dependent bounds are better than data-independent
      # bounds in the extreme cases when max(votes) is minimal or maximal.
      # For both Confident GNMax and Interactive GNMax it holds that
      #   0 <= max(votes) <= num_teachers.
      # The upper bound is trivial in both cases.
      # The lower bound is trivial for Confident GNMax (and a stronger one, based on
      # the pigeonhole principle, is possible).
      # For Interactive GNMax (Algorithm 2), the lower bound follows from the
      # following argument. Since the votes vector is the difference between the
      # actual teachers' votes and the student's baseline, we need to argue that
      # max(n_j - M * p_j) >= 0.
      # The bound holds because sum_j n_j = sum M * p_j = M. Thus,
      # sum_j (n_j - M * p_j) = 0, and max_j (n_j - M * p_j) >= 0 as needed.
      logq1 = compute_logpr_answered(threshold, sigma, [0])
      logq2 = compute_logpr_answered(threshold, sigma, [num_teachers])
  
      rdp_dep1 = compute_rdp_threshold(logq1, sigma, orders)
      rdp_dep2 = compute_rdp_threshold(logq2, sigma, orders)
  
      rdp_ind = compute_rdp_data_independent_threshold(sigma, orders)
      return np.isclose(rdp_dep1, rdp_ind) and np.isclose(
          rdp_dep2, rdp_ind
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  from absl import app
  import numpy
  import scipy.stats
label_desc: Use image node_id 11 for calling a global function with example usage: is_data_independent_always_opt_threshold(num_teachers, threshold, sigma, orders) and returns: unknown