code: def two_class_accuracy(predictions, labels, weights_fn=None):
      """Accuracy for two class classification with 0/1 labels."""
      with tf.variable_scope(
          "two_class_accuracy", values=[predictions, labels]
      ):
          del weights_fn
          hard_predictions = tf.to_int32(
              tf.math.round(tf.squeeze(predictions))
          )
          int_labels = tf.to_int32(labels)
          _, accuracy = tf.metrics.accuracy(
              labels=int_labels, predictions=hard_predictions
          )
          return accuracy, 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 10 for calling a global function with example usage: two_class_accuracy(predictions, labels, weights_fn) and returns: accuracy,  tf