class_docstr: Computes mean metric.
class_docstr_tok: ["Computes","mean","metric","."]
code: def add_input(
      self,
      accumulator: _Accumulator,
      element: metric_types.StandardMetricInputs,
  ) -> _Accumulator:
      # Get feature value
      features = util.get_by_keys(element, self._feature_key_path)
      assert len(features) == 1, (
          "Mean() is only supported for scalar features, but found features = "
          f"{features}"
      )
  
      # Get example weight
      if self._example_weights_key_path is None:
          example_weight = 1.0
      else:
          example_weights = util.get_by_keys(
              element, self._example_weights_key_path
          )
          assert len(example_weights) == 1, (
              "Expected 1 (scalar) example weight for each example, "
              f"but found example weight = {example_weights}"
          )
          example_weight = example_weights[0]
  
      # Update accumulator
      accumulator.count += example_weight
      accumulator.total += example_weight * features[0]
  
      return accumulator
  
file_path: model-analysis/tensorflow_model_analysis/metrics/stats.py
imports: import dataclasses
  from typing import Any, Dict, Iterable, Optional, Tuple, Union
  import apache_beam
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 3 for calling the _MeanCombiner obj's underlying member method code with example usage: obj.add_input(accumulator, element) and returns: accumulator