code: def get_stat_and_loss_aug(
      model,
      x,
      y,
      sample_weight: Optional[np.ndarray] = None,
      batch_size=4096,
  ):
      """A helper function to get the statistics and losses.
  
      Here we get the statistics and losses for the original and
      horizontally flipped image, as we are going to train the model with
      random horizontal flip.
  
      Args:
        model: model to make prediction
        x: samples
        y: true labels of samples (integer valued)
        sample_weight: a vector of weights of shape (n_samples, ) 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.
        batch_size: the batch size for model.predict
  
      Returns:
        the statistics and cross-entropy losses
      """
      losses, stat = [], []
      for data in [x, x[:, :, ::-1, :]]:
          prob = amia.convert_logit_to_prob(
              model.predict(data, batch_size=batch_size)
          )
          losses.append(
              utils.log_loss(y, prob, sample_weight=sample_weight)
          )
          stat.append(
              amia.calculate_statistic(
                  prob,
                  y,
                  sample_weight=sample_weight,
                  convert_to_prob=False,
              )
          )
      return np.vstack(stat).transpose(1, 0), np.vstack(
          losses
      ).transpose(1, 0)
  
file_path: privacy/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/advanced_mia_example.py
imports: import functools
  import gc
  import os
  from typing import Optional
  from absl import app
  from absl import flags
  import matplotlib.pyplot
  import numpy
  import tensorflow
  from tensorflow_privacy.privacy.privacy_tests import utils
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import advanced_mia
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import membership_inference_attack
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import plotting
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import AttackInputData
label_desc: Use image node_id 4 for calling a global function with example usage: get_stat_and_loss_aug(model, x, y, sample_weight, batch_size) and returns: np,  np