code: def run_attack_helper(
      estimator,
      in_train_input_fn,
      out_train_input_fn,
      in_train_labels,
      out_train_labels,
      in_train_sample_weight: Optional[np.ndarray] = None,
      out_train_sample_weight: Optional[np.ndarray] = None,
      slicing_spec: data_structures.SlicingSpec = None,
      attack_types: Iterable[data_structures.AttackType] = (
          data_structures.AttackType.THRESHOLD_ATTACK,
      ),
  ):
      """A helper function to perform attack.
  
      Args:
        estimator: model to be tested
        in_train_input_fn: input_fn for in training data
        out_train_input_fn: input_fn for out of training data
        in_train_labels: in training labels
        out_train_labels: out of training labels
        in_train_sample_weight: a vector of weights of shape (n_train, ) that are
          assigned to individual samples. If not provided, then each sample is
          given unit weight. Only the LogisticRegressionAttacker and the
          RandomForestAttacker support sample weights.
        out_train_sample_weight: a vector of weights of shape (n_test, ) that are
          assigned to individual samples. If not provided, then each sample is
          given unit weight. Only the LogisticRegressionAttacker and the
          RandomForestAttacker support sample weights.
        slicing_spec: slicing specification of the attack
        attack_types: a list of attacks, each of type AttackType
  
      Returns:
        Results of the attack
      """
      # Compute predictions and losses
      in_train_pred, in_train_loss = calculate_losses(
          estimator,
          in_train_input_fn,
          in_train_labels,
          sample_weight=in_train_sample_weight,
      )
      out_train_pred, out_train_loss = calculate_losses(
          estimator,
          out_train_input_fn,
          out_train_labels,
          sample_weight=out_train_sample_weight,
      )
      attack_input = data_structures.AttackInputData(
          logits_train=in_train_pred,
          logits_test=out_train_pred,
          labels_train=in_train_labels,
          labels_test=out_train_labels,
          loss_train=in_train_loss,
          loss_test=out_train_loss,
          sample_weight_train=in_train_sample_weight,
          sample_weight_test=out_train_sample_weight,
      )
      results = mia.run_attacks(
          attack_input,
          slicing_spec=slicing_spec,
          attack_types=attack_types,
      )
      return results
  
file_path: privacy/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation.py
imports: import os
  from typing import Iterable, Optional
  from absl import logging
  import numpy
  import tensorflow
  from tensorflow import estimator
  from tensorflow_privacy.privacy.privacy_tests import utils
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import data_structures
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import membership_inference_attack
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import utils_tensorboard
label_desc: Use image node_id 3 for calling a global function with example usage: run_attack_helper(estimator, in_train_input_fn, out_train_input_fn, in_train_labels, out_train_labels, in_train_sample_weight, out_train_sample_weight, slicing_spec, attack_types) and returns: results