code: def two_class_log_likelihood(predictions, labels, weights_fn=None):
      """Log-likelihood for two class classification with 0/1 labels.
  
      Args:
        predictions: A float valued tensor of shape [`batch_size`].  Each
          component should be between 0 and 1.
        labels: An int valued tensor of shape [`batch_size`].  Each component
          should either be 0 or 1.
        weights_fn: unused.
  
      Returns:
        A pair, with the average log likelihood in the first component.
      """
      del weights_fn
      float_predictions = tf.cast(
          tf.squeeze(predictions), dtype=tf.float64
      )
      batch_probs = tf.stack(
          [1.0 - float_predictions, float_predictions], axis=-1
      )
      int_labels = tf.cast(tf.squeeze(labels), dtype=tf.int32)
      onehot_targets = tf.cast(
          tf.one_hot(int_labels, 2), dtype=tf.float64
      )
      chosen_probs = tf.einsum(
          "ij,ij->i", batch_probs, onehot_targets, name="chosen_probs"
      )
      avg_log_likelihood = tf.reduce_mean(tf.log(chosen_probs))
      return avg_log_likelihood, tf.constant(1.0)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import six
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import modalities
  from tensor2tensor.utils import bleu_hook
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import rouge
  from tensor2tensor.utils import sari_hook
  import tensorflow.compat.v1
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 11 for calling a global function with example usage: two_class_log_likelihood(predictions, labels, weights_fn) and returns: avg_log_likelihood,  tf