class_docstr: Combines compilable metric weights and computes result.
class_docstr_tok: ["Combines","compilable","metric","weights","and","computes","result","."]
code: def merge_accumulators(
      self,
      accumulators: Iterable[
          tf_metric_accumulators.TFCompilableMetricsAccumulator
      ],
  ) -> tf_metric_accumulators.TFCompilableMetricsAccumulator:
      accumulators = iter(accumulators)
      result = next(accumulators)
      self._process_batch(result)
      for accumulator in accumulators:
          # Finish processing last batch
          self._process_batch(accumulator)
          # Merge the weights
          for output_index, output_name in enumerate(
              self._output_names
          ):
              for metric_index in range(
                  len(self._metrics[output_name])
              ):
                  weights = accumulator.get_weights(
                      output_index, metric_index
                  )
                  if weights is None:
                      # It is possible for beam to create an accumulator but pass no
                      # inputs to it resulting in in empty weights. In theory all weights
                      # should be empty but we check on a per metric weights basis.
                      continue
                  result.add_weights(
                      output_index, metric_index, weights
                  )
      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 6 for calling the _CompilableMetricsCombiner obj's underlying member method code with example usage: obj.merge_accumulators(accumulators) and returns: result