code: def run_attacks(
      attack_input: AttackInputData,
      slicing_spec: SlicingSpec = None,
      attack_types: Iterable[AttackType] = (
          AttackType.THRESHOLD_ATTACK,
      ),
      privacy_report_metadata: PrivacyReportMetadata = None,
      balance_attacker_training: bool = True,
      min_num_samples: int = 1,
      backend: Optional[str] = None,
      return_slice_indices=False,
  ) -> AttackResults:
      """Runs membership inference attacks on a classification model.
  
      It runs attacks specified by attack_types on each attack_input slice which is
       specified by slicing_spec.
  
      Args:
        attack_input: input data for running an attack
        slicing_spec: specifies attack_input slices to run attack on
        attack_types: attacks to run
        privacy_report_metadata: the metadata of the model under attack.
        balance_attacker_training: Whether the training and test sets for the
          membership inference attacker should have a balanced (roughly equal)
          number of samples from the training and test sets used to develop the
          model under attack.
        min_num_samples: minimum number of examples in either training or test data.
        backend: The Scikit-Learn/Joblib backend to use for model training, defaults
          to `None`, which will use single-threaded training. Note that some systems
          may not support multiprocessing and in those cases the `threading` backend
          should be used. See https://joblib.readthedocs.io/en/latest/parallel.html
          for more details.
        return_slice_indices: if true, the result for each slice will include the
          indices of train and test data examples that were used for this slice and
          attacks. This does not return indices for the "whole dataset" slice.
  
      Returns:
        the attack result.
      """
      attack_input.validate()
      attack_results = []
      attack_types = list(attack_types)
  
      if slicing_spec is None:
          slicing_spec = SlicingSpec(entire_dataset=True)
      num_classes = None
      if slicing_spec.by_class:
          num_classes = attack_input.num_classes
      input_slice_specs = get_single_slice_specs(
          slicing_spec, num_classes
      )
      num_slice_specs = len(input_slice_specs)
      num_attacks = len(attack_types)
      logging.info(
          "Will run %s attacks on each of %s slice specifications.",
          num_attacks,
          num_slice_specs,
      )
      for single_slice_spec in input_slice_specs:
          attack_input_slice = get_slice(
              attack_input, single_slice_spec, return_slice_indices
          )
          for attack_type in attack_types:
              logging.info("Running attack: %s", attack_type.name)
              attack_result = _run_attack(
                  attack_input_slice,
                  attack_type,
                  balance_attacker_training,
                  min_num_samples,
                  backend,
              )
              if attack_result is not None:
                  logging.info(
                      "%s attack had an AUC=%s, attacker advantage=%s and "
                      "positive predictive value=%s",
                      attack_type.name,
                      attack_result.get_auc(),
                      attack_result.get_attacker_advantage(),
                      attack_result.get_ppv(),
                  )
                  if (
                      return_slice_indices
                      and not single_slice_spec.entire_dataset
                  ):
                      attack_result.train_indices = (
                          attack_input_slice.train_indices
                      )
                      attack_result.test_indices = (
                          attack_input_slice.test_indices
                      )
                  attack_results.append(attack_result)
  
      privacy_report_metadata = (
          _compute_missing_privacy_report_metadata(
              privacy_report_metadata, attack_input
          )
      )
  
      return AttackResults(
          single_attack_results=attack_results,
          privacy_report_metadata=privacy_report_metadata,
      )
  
imports: import logging
  from typing import Iterable, List, Optional, Union
  import numpy
  from scipy import special
  from sklearn import metrics
  from sklearn import model_selection
  from tensorflow_privacy.privacy.privacy_tests import epsilon_lower_bound
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import models
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackInputData
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackResults
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackType
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import DataSize
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import EPSILON_ALPHA
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import EPSILON_K
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import EPSILON_METHODS
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import EpsilonLowerBoundValue
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import MembershipProbabilityResults
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import PrivacyReportMetadata
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import RocCurve
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SingleAttackResult
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SingleMembershipProbabilityResult
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SingleSliceSpec
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SlicingSpec
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.dataset_slicing import get_single_slice_specs
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.dataset_slicing import get_slice
label_desc: Use image node_id 6 for calling a global function with example usage: run_attacks(attack_input, slicing_spec, attack_types, privacy_report_metadata, balance_attacker_training, min_num_samples, backend, return_slice_indices) and returns: AttackResults