code: def testWithMixedMetrics(self):
      computations = tf_metric_wrapper.tf_metric_computations(
          [
              tf.keras.metrics.AUC(name="auc"),
              tf.keras.losses.BinaryCrossentropy(
                  name="binary_crossentropy"
              ),
              tf.keras.metrics.MeanSquaredError(name="mse"),
          ]
      )
  
      confusion_histogram = computations[0]
      confusion_matrix = computations[1].result
      confusion_metrics = computations[2].result
      non_confusion_metrics = computations[3]
  
      example1 = {
          "labels": np.array([0.0]),
          "predictions": np.array([0.0]),
          "example_weights": np.array([1.0]),
      }
      example2 = {
          "labels": np.array([0.0]),
          "predictions": np.array([0.5]),
          "example_weights": np.array([1.0]),
      }
      example3 = {
          "labels": np.array([1.0]),
          "predictions": np.array([0.3]),
          "example_weights": np.array([1.0]),
      }
      example4 = {
          "labels": np.array([1.0]),
          "predictions": np.array([0.9]),
          "example_weights": np.array([1.0]),
      }
  
      with beam.Pipeline() as pipeline:
          # pylint: disable=no-value-for-parameter
          sliced_examples = (
              pipeline
              | "Create"
              >> beam.Create([example1, example2, example3, example4])
              | "Process"
              >> beam.Map(metric_util.to_standard_metric_inputs)
              | "AddSlice" >> beam.Map(lambda x: ((), x))
          )
  
          confusion_result = (
              sliced_examples
              | "ComputeHistogram"
              >> beam.CombinePerKey(confusion_histogram.combiner)
              | "ComputeConfusionMatrix"
              >> beam.Map(
                  lambda x: (x[0], confusion_matrix(x[1]))
              )  # pyformat: disable
              | "ComputeMetric"
              >> beam.Map(lambda x: (x[0], confusion_metrics(x[1])))
          )  # pyformat: disable
  
          non_confusion_result = (
              sliced_examples
              | "Combine"
              >> beam.CombinePerKey(non_confusion_metrics.combiner)
          )
  
          # pylint: enable=no-value-for-parameter
  
          def check_confusion_result(got):
              try:
                  self.assertLen(got, 1)
                  got_slice_key, got_metrics = got[0]
                  self.assertEqual(got_slice_key, ())
                  auc_key = metric_types.MetricKey(name="auc")
                  self.assertDictElementsAlmostEqual(
                      got_metrics, {auc_key: 0.75}, places=5
                  )
  
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          def check_non_confusion_result(got):
              try:
                  self.assertLen(got, 1)
                  got_slice_key, got_metrics = got[0]
                  self.assertEqual(got_slice_key, ())
                  mse_key = metric_types.MetricKey(name="mse")
                  binary_crossentropy_key = metric_types.MetricKey(
                      name="binary_crossentropy"
                  )
                  self.assertDictElementsAlmostEqual(
                      got_metrics,
                      {
                          mse_key: 0.1875,
                          binary_crossentropy_key: 0.50061995,
                      },
                      places=5,
                  )
  
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          util.assert_that(
              confusion_result,
              check_confusion_result,
              label="confusion",
          )
          util.assert_that(
              non_confusion_result,
              check_non_confusion_result,
              label="non_confusion",
          )
  
imports: from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import tensorflow
  from tensorflow_model_analysis.eval_saved_model import testutil
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import tf_metric_wrapper
  from tensorflow_model_analysis.proto import config_pb2
label_desc: Use image node_id 1 for calling the MixedMetricsTest obj's underlying member method code with example usage: obj.testWithMixedMetrics() without return types