class_docstr: A container class for metrics passed to `Model.compile`.
class_docstr_tok: ["A","container","class","for","metrics","passed","to","`","Model.compile","`","."]
docstr: Updates the state of per-output metrics.
code: def update_state(self, y_true, y_pred, sample_weight=None):
      """Updates the state of per-output metrics."""
      y_true = self._conform_to_outputs(y_pred, y_true)
      sample_weight = self._conform_to_outputs(y_pred, sample_weight)
  
      if not self._built:
          self.build(y_pred, y_true)
  
      y_pred = nest.flatten(y_pred)
      y_true = nest.flatten(y_true) if y_true is not None else []
      sample_weight = nest.flatten(sample_weight)
  
      zip_args = (
          y_true,
          y_pred,
          sample_weight,
          self._metrics,
          self._weighted_metrics,
      )
      for y_t, y_p, sw, metric_objs, weighted_metric_objs in zip(
          *zip_args
      ):
          # Ok to have no metrics for an output.
          if y_t is None or (
              all(m is None for m in metric_objs)
              and all(wm is None for wm in weighted_metric_objs)
          ):
              continue
  
          y_t, y_p, sw = match_dtype_and_rank(y_t, y_p, sw)
          mask = get_mask(y_p)
          sw = apply_mask(y_p, sw, mask)
  
          for metric_obj in metric_objs:
              if metric_obj is None:
                  continue
              metric_obj.update_state(y_t, y_p, sample_weight=mask)
  
          for weighted_metric_obj in weighted_metric_objs:
              if weighted_metric_obj is None:
                  continue
              weighted_metric_obj.update_state(
                  y_t, y_p, sample_weight=sw
              )
  
imports: import copy
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.keras import losses
  from tensorflow.python.keras import metrics
  from tensorflow.python.keras.utils import generic_utils
  from tensorflow.python.keras.utils import losses_utils
  from tensorflow.python.keras.utils import tf_utils
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 9 for calling the MetricsContainer obj's underlying member method code with example usage: obj.update_state(y_true, y_pred, sample_weight) without return types