code: def testCustomTFMetricWithPadding(self, example_indices, expected):
      computation = tf_metric_wrapper.tf_metric_computations(
          [
              _CustomMetric(name="custom_label", update_y_pred=False),
              _CustomMetric(name="custom_pred", update_y_pred=True),
          ],
          eval_config=config_pb2.EvalConfig(
              model_specs=[
                  config_pb2.ModelSpec(
                      padding_options=config_pb2.PaddingOptions(
                          label_int_padding=-1,
                          prediction_float_padding=-1.0,
                      )
                  )
              ]
          ),
          example_weighted=True,
      )[0]
  
      examples = [
          {
              "labels": np.array([1], dtype=np.int64),
              "predictions": np.array([0.1, 0.2, 0.3, 0.0]),
              "example_weights": np.array([1.0]),
          },
          {
              "labels": np.array([1, 2], dtype=np.int64),
              "predictions": np.array([0.1, 0.2, 0.0]),
              "example_weights": np.array([1.0]),
          },
          {
              "labels": np.array([1, 2, 3], dtype=np.int64),
              "predictions": np.array([0.1, 0.2, 0.3]),
              "example_weights": np.array([2.0]),
          },
      ]
  
      with beam.Pipeline() as pipeline:
          # pylint: disable=no-value-for-parameter
          result = (
              pipeline
              | "Create"
              >> beam.Create([examples[i] for i in example_indices])
              | "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, ())
  
                  custom_label_key = metric_types.MetricKey(
                      name="custom_label", example_weighted=True
                  )
                  custom_pred_key = metric_types.MetricKey(
                      name="custom_pred", example_weighted=True
                  )
                  self.assertDictElementsAlmostEqual(
                      got_metrics, expected
                  )
  
              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 7 for calling the NonConfusionMatrixMetricsTest obj's underlying member method code with example usage: obj.testCustomTFMetricWithPadding(example_indices, expected) without return types