code: def testTotalAttributionsWithSubKeys(self, sub_key, expected_values):
      computations = attributions.TotalAttributions().computations(
          sub_keys=[sub_key]
      )
  
      example1 = {
          "labels": None,
          "predictions": None,
          "example_weights": np.array(1.0),
          "attributions": {
              "feature1": [1.11, 1.13, 1.12],
              "feature2": [1.21, 1.23, 1.22],
          },
      }
      example2 = {
          "labels": None,
          "predictions": None,
          "example_weights": np.array(1.0),
          "attributions": {
              "feature1": [2.11, 2.13, 2.12],
              "feature2": [2.21, 2.23, 2.22],
          },
      }
      example3 = {
          "labels": None,
          "predictions": None,
          "example_weights": np.array(1.0),
          "attributions": {
              "feature1": np.array([3.11, 3.13, 3.12]),
              "feature2": np.array([3.21, 3.23, 3.22]),
          },
      }
  
      with beam.Pipeline() as pipeline:
          # pylint: disable=no-value-for-parameter
          result = (
              pipeline
              | "Create" >> beam.Create([example1, example2, example3])
              | "Process"
              >> beam.Map(metric_util.to_standard_metric_inputs)
              | "AddSlice" >> beam.Map(lambda x: ((), x))
              | "CombineAttributions"
              >> beam.CombinePerKey(computations[0].combiner)
              | "ComputeResult"
              >> beam.Map(  # comment to add lamda on own line
                  lambda x: (x[0], computations[1].result(x[1]))
              )
          )
  
          # pylint: enable=no-value-for-parameter
  
          def check_result(got):
              try:
                  self.assertLen(got, 1)
                  got_slice_key, got_attributions = got[0]
                  self.assertEqual(got_slice_key, ())
                  total_attributions_key = metric_types.AttributionsKey(
                      name="total_attributions", sub_key=sub_key
                  )
                  self.assertIn(
                      total_attributions_key, got_attributions
                  )
                  self.assertAllClose(
                      got_attributions[total_attributions_key],
                      expected_values,
                  )
  
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          util.assert_that(result, check_result, label="result")
  
file_path: model-analysis/tensorflow_model_analysis/metrics/attributions_test.py
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 attributions
  from tensorflow_model_analysis.metrics import metric_specs
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
label_desc: Use image node_id 5 for calling the AttributionsTest obj's underlying member method code with example usage: obj.testTotalAttributionsWithSubKeys(sub_key, expected_values) without return types