class_docstr: Combines compilable metric weights and computes result.
class_docstr_tok: ["Combines","compilable","metric","weights","and","computes","result","."]
code: def extract_output(
      self,
      accumulator: tf_metric_accumulators.TFCompilableMetricsAccumulator,
  ) -> Dict[metric_types.MetricKey, Any]:
      self._process_batch(accumulator)
  
      def make_metric_key(metric_name, output_name):
          return metric_types.MetricKey(
              name=metric_name,
              model_name=self._model_name,
              output_name=output_name,
              sub_key=self._sub_key,
              example_weighted=self._example_weighted,
          )
  
      result = {}
      for output_index, output_name in enumerate(self._output_names):
          for metric_index, metric in enumerate(
              self._metrics[output_name]
          ):
              weights = accumulator.get_weights(
                  output_index, metric_index
              )
              if weights is not None:
                  metric.set_weights(weights)
              else:
                  metric.reset_states()
              metric_result = metric.result()
              if isinstance(metric_result, dict):
                  for name, value in metric_result.items():
                      key = make_metric_key(
                          f"{metric.name}/{name}", output_name
                      )
                      result[key] = value.numpy()
              else:
                  key = make_metric_key(metric.name, output_name)
                  result[key] = metric_result.numpy()
      return result
  
imports: import collections
  import importlib
  import itertools
  from typing import Any, Dict, Iterable, List, Optional, Type, Tuple, Union
  import apache_beam
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.metrics import binary_confusion_matrices
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import tf_metric_accumulators
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import model_util
label_desc: Use image node_id 8 for calling the _CompilableMetricsCombiner obj's underlying member method code with example usage: obj.extract_output(accumulator) and returns: result, metric_types