class_docstr: Computes PredictionDifference.
class_docstr_tok: ["Computes","PredictionDifference","."]
code: def add_input(
      self,
      accumulator: _SymmetricPredictionDifferenceAccumulator,
      element: metric_types.StandardMetricInputs,
  ) -> _SymmetricPredictionDifferenceAccumulator:
      _, base_prediction, base_example_weight = next(
          metric_util.to_label_prediction_example_weight(
              element,
              eval_config=self._eval_config,
              model_name=self._baseline_model_name,
              output_name=self._output_name,
              flatten=True,
              example_weighted=self._example_weighted,
          )
      )
  
      _, model_prediction, _ = next(
          metric_util.to_label_prediction_example_weight(
              element,
              eval_config=self._eval_config,
              model_name=self._model_name,
              output_name=self._output_name,
              flatten=True,
              example_weighted=self._example_weighted,
          )
      )
      base_example_weight = metric_util.safe_to_scalar(
          base_example_weight
      )
      accumulator.num_weighted_examples += base_example_weight
      numerator = 2 * abs(base_prediction - model_prediction)
      denominator = abs(base_prediction + model_prediction)
      if numerator < _K_EPSILON and denominator < _K_EPSILON:
          sym_pd = 0.0
      else:
          sym_pd = metric_util.safe_to_scalar((numerator / denominator))
      accumulator.total_pointwise_sym_diff += (
          sym_pd * base_example_weight
      )
      return accumulator
  
file_path: model-analysis/tensorflow_model_analysis/metrics/prediction_difference_metrics.py
imports: import dataclasses
  from typing import Optional, Dict, Iterable, List
  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
  from tensorflow_model_analysis.utils import model_util
label_desc: Use image node_id 3 for calling the _SymmetricPredictionDifferenceCombiner obj's underlying member method code with example usage: obj.add_input(accumulator, element) and returns: accumulator