code: def test_auc_metric_fn(
      self,
      metric_fn_factory,
      label_vocabulary,
      labels_fn,
      predictions_fn,
      expected_metric_dict,
  ):
      # Force graph mode
      with tf.compat.v1.Graph().as_default():
          metric_fn = metric_fn_factory(label_vocabulary)
          actual_metric_dict = metric_fn(labels_fn(), predictions_fn())
          with self.test_session() as sess:
              sess.run(tf.compat.v1.initializers.local_variables())
              sess.run(tf.compat.v1.initializers.tables_initializer())
              actual_metric_dict_val = sess.run(actual_metric_dict)
          actual_metric_dict_val_clean = {
              metric_key: metric_val[1]
              for metric_key, metric_val in actual_metric_dict_val.items()
          }
          self.assertAllClose(
              expected_metric_dict, actual_metric_dict_val_clean
          )
  
file_path: model_search/model_search/metric_fns_test.py
imports: from absl.testing import parameterized
  from model_search import metric_fns
  import numpy
  import tensorflow.compat.v2
label_desc: Use image node_id 2 for calling the MetricFnsTest obj's underlying member method code with example usage: obj.test_auc_metric_fn(metric_fn_factory, label_vocabulary, labels_fn, predictions_fn, expected_metric_dict) without return types