class_docstr: Aggregates metrics using keras compiled_metrics and compiled_loss.
class_docstr_tok: ["Aggregates","metrics","using","keras","compiled_metrics","and","compiled_loss","."]
code: def _update_state(
      self,
      accumulator: tf_metric_accumulators.TFCompilableMetricsAccumulator,
  ):
      if len(self._output_names) == 1:
          # Single-output models don't use dicts.
          l, p, w = accumulator.get_inputs(0)
          labels = tf.convert_to_tensor(l)
          predictions = tf.convert_to_tensor(p)
          example_weights = tf.convert_to_tensor(w)
      else:
          labels = {}
          predictions = {}
          example_weights = {}
          for i, output_name in enumerate(self._output_names):
              if not output_name:
                  # The empty output_name for multi-output models is not used for inputs
                  continue
              l, p, w = accumulator.get_inputs(i)
              labels[output_name] = tf.convert_to_tensor(l)
              predictions[output_name] = tf.convert_to_tensor(p)
              example_weights[output_name] = tf.convert_to_tensor(w)
      self._model.compiled_metrics.update_state(
          labels, predictions, sample_weight=example_weights
      )
      self._model.compiled_loss(
          labels, predictions, sample_weight=example_weights
      )
  
imports: import collections
  from itertools import chain
  from typing import Dict, Iterable, List, Optional
  import apache_beam
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  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
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 5 for calling the _KerasCompiledMetricsCombiner obj's underlying member method code with example usage: obj._update_state(accumulator) without return types