class_docstr: Combines Exact Match scores.
class_docstr_tok: ["Combines","Exact","Match","scores","."]
code: def add_input(
      self,
      accumulator: _ExactMatchAccumulator,
      element: metric_types.StandardMetricInputs,
  ) -> _ExactMatchAccumulator:
      for (
          label,
          prediction,
          example_weight,
      ) in metric_util.to_label_prediction_example_weight(
          element,
          eval_config=self._eval_config,
          model_name=self._key.model_name,
          output_name=self._key.output_name,
          aggregation_type=self._aggregation_type,
          class_weights=self._class_weights,
          example_weighted=self._example_weighted,
      ):
          label = label.tolist()
          prediction = prediction.tolist()
          if self._convert_to == _JSON:
              label = [json.loads(l) for l in label]
              prediction = [json.loads(p) for p in prediction]
          match = [p == l for p, l in zip(prediction, label)]
          score = int(all(match))
          example_weight = metric_util.safe_to_scalar(example_weight)
          accumulator.total_weighted_exact_match_scores += (
              score * example_weight
          )
          accumulator.total_weighted_examples += example_weight
      return accumulator
  
file_path: model-analysis/tensorflow_model_analysis/metrics/exact_match.py
imports: import json
  from typing import Dict, Iterable, Optional
  import apache_beam
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.proto import config_pb2
label_desc: Use image node_id 3 for calling the _ExactMatchCombiner obj's underlying member method code with example usage: obj.add_input(accumulator, element) and returns: accumulator