code: def testTFMetricWithClassID(self):
      computation = tf_metric_wrapper.tf_metric_computations(
          [tf.keras.metrics.MeanSquaredError(name="mse")],
          sub_key=metric_types.SubKey(class_id=1),
          example_weighted=False,
      )[0]
  
      example1 = {
          "labels": [2],
          "predictions": [0.5, 0.0, 0.5],
          "example_weights": [0.1],  # ignored, example_weighted=False
      }
      example2 = {
          "labels": [0],
          "predictions": [0.2, 0.5, 0.3],
          "example_weights": [0.2],  # ignored, example_weighted=False
      }
      example3 = {
          "labels": [1],
          "predictions": [0.2, 0.3, 0.5],
          "example_weights": [0.3],  # ignored, example_weighted=False
      }
      example4 = {
          "labels": [1],
          "predictions": [0.0, 0.9, 0.1],
          "example_weights": [0.4],  # ignored, example_weighted=False
      }
  
      with beam.Pipeline() as pipeline:
          # pylint: disable=no-value-for-parameter
          result = (
              pipeline
              | "Create"
              >> beam.Create([example1, example2, example3, example4])
              | "Process"
              >> beam.Map(metric_util.to_standard_metric_inputs)
              | "AddSlice" >> beam.Map(lambda x: ((), x))
              | "Combine" >> beam.CombinePerKey(computation.combiner)
          )
  
          # pylint: enable=no-value-for-parameter
  
          def check_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",
                      sub_key=metric_types.SubKey(class_id=1),
                      example_weighted=False,
                  )
                  self.assertDictElementsAlmostEqual(
                      got_metrics,
                      {
                          mse_key: 0.1875,
                      },
                  )
  
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          util.assert_that(result, check_result, label="result")
  
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 10 for calling the NonConfusionMatrixMetricsTest obj's underlying member method code with example usage: obj.testTFMetricWithClassID() without return types