code: def calculate_losses(
      model, data, labels, is_logit=False, batch_size=32
  ):
      """Calculate losses of model prediction on data, provided true labels.
  
      Args:
        model: model to make prediction
        data: samples
        labels: true labels of samples (integer valued)
        is_logit: whether the result of model.predict is logit or probability
        batch_size: the batch size for model.predict
  
      Returns:
        pred: probability vector of each sample
        loss: cross entropy loss of each sample
      """
      pred = model.predict(data, batch_size=batch_size)
      if is_logit:
          pred = tf.nn.softmax(pred).numpy()
      loss = log_loss(labels, pred)
      return pred, loss
  
file_path: privacy/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/keras_evaluation.py
imports: import os
  from typing import Iterable
  from absl import logging
  import tensorflow
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import membership_inference_attack
  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 AttackType
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import get_flattened_attack_metrics
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.data_structures import SlicingSpec
  from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.utils_tensorboard import write_results_to_tensorboard_tf2
  from tensorflow_privacy.privacy.privacy_tests.utils import log_loss
label_desc: Use image node_id 1 for calling a global function with example usage: calculate_losses(model, data, labels, is_logit, batch_size) and returns: pred,  loss