code: def compute_dpsgd_noise_multiplier(
      num_train: int,
      epsilon: float,
      delta: float,
      epochs: int,
      batch_size: int,
      tolerance: float = 1e-2,
  ) -> Optional[float]:
      """Computes the noise multiplier for DP-SGD given privacy parameters.
  
        The algorithm performs binary search on the values of epsilon.
  
      Args:
        num_train: number of input training points.
        epsilon: epsilon parameter in (epsilon, delta)-DP.
        delta: delta parameter in (epsilon, delta)-DP.
        epochs: number of training epochs.
        batch_size: the number of examples in each batch of gradient descent.
        tolerance: an upper bound on the absolute difference between the input
          (desired) epsilon and the epsilon value corresponding to the
          noise_multiplier that is output.
  
      Returns:
        noise_multiplier: the smallest noise multiplier value (within plus or minus
        the given tolerance) for which using DPKerasAdamOptimizer will result in an
        (epsilon, delta)-differentially private trained model.
      """
      orders = (
          [1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 3.0, 3.5, 4.0, 4.5]
          + list(range(5, 64))
          + [128, 256, 512]
      )
      steps = int(math.ceil(epochs * num_train / batch_size))
  
      def make_event_from_param(noise_multiplier):
          return dp_accounting.SelfComposedDpEvent(
              dp_accounting.PoissonSampledDpEvent(
                  sampling_probability=batch_size / num_train,
                  event=dp_accounting.GaussianDpEvent(noise_multiplier),
              ),
              steps,
          )
  
      return dp_accounting.calibrate_dp_mechanism(
          lambda: dp_accounting.rdp.RdpAccountant(orders),
          make_event_from_param,
          epsilon,
          delta,
          dp_accounting.LowerEndpointAndGuess(0, 1),
          tol=tolerance,
      )
  
file_path: privacy/tensorflow_privacy/privacy/logistic_regression/multinomial_logistic.py
imports: import math
  from typing import List, Optional, Tuple
  import dp_accounting
  import numpy
  import tensorflow
  from tensorflow_privacy.privacy.logistic_regression import datasets
  from tensorflow_privacy.privacy.logistic_regression import single_layer_softmax
  from tensorflow_privacy.privacy.optimizers import dp_optimizer_keras
label_desc: Use image node_id 2 for calling a global function with example usage: compute_dpsgd_noise_multiplier(num_train, epsilon, delta, epochs, batch_size, tolerance) and returns: dp_accounting, dp_accounting