class_docstr: Computes total attributions.
code: def add_input(
      self,
      accumulator: Dict[str, List[float]],
      extracts: metric_types.StandardMetricInputs,
  ) -> Dict[str, List[float]]:
      if constants.ATTRIBUTIONS_KEY not in extracts:
          raise ValueError(
              "{} missing from extracts {}\n\n. An attribution extractor is "
              "required to use attribution metrics".format(
                  constants.ATTRIBUTIONS_KEY, extracts
              )
          )
      attributions = extracts[constants.ATTRIBUTIONS_KEY]
      if self._key.model_name:
          attributions = util.get_by_keys(
              attributions, [self._key.model_name]
          )
      if self._key.output_name:
          attributions = util.get_by_keys(
              attributions, [self._key.output_name]
          )
      _, _, example_weight = next(
          metric_util.to_label_prediction_example_weight(
              extracts,
              eval_config=self._eval_config,
              model_name=self._key.model_name,
              output_name=self._key.output_name,
              sub_key=self._key.sub_key,
              example_weighted=self._key.example_weighted,
              allow_none=True,
              flatten=False,
          )
      )
      example_weight = float(example_weight)
      for k, v in attributions.items():
          v = util.to_numpy(v)
          if self._key.sub_key is not None:
              if self._key.sub_key.class_id is not None:
                  v = _scores_by_class_id(self._key.sub_key.class_id, v)
              elif self._key.sub_key.k is not None:
                  v = _scores_by_top_k(self._key.sub_key.k, v)
                  v = np.array(v[self._key.sub_key.k - 1])
              elif self._key.sub_key.top_k is not None:
                  v = _scores_by_top_k(self._key.sub_key.top_k, v)
          if k not in accumulator:
              accumulator[k] = [0.0] * v.size
          self._sum(accumulator[k], v * example_weight)
      return accumulator
  
imports: import functools
  from typing import Any, Dict, Iterable, List, Optional, Union
  import apache_beam
  import numpy
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.metrics import example_count
  from tensorflow_model_analysis.metrics import metric_specs
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 4 for calling the _TotalAttributionsCombiner obj's underlying member method code with example usage: obj.add_input(accumulator, extracts) and returns: accumulator