code: def update_state(self, y_true, y_pred, sample_weight=None):
      if not self.built:
          self.build(y_true, y_pred)
      y_true = self._flatten_y(y_true)
      y_pred = self._flatten_y(y_pred)
      for m, y_t, y_p in zip(self._flat_metrics, y_true, y_pred):
          if m:
              m.update_state(y_t, y_p)
      if sample_weight is not None:
          sample_weight = self._flatten_y(sample_weight)
          # For multi-outputs, repeat sample weights for n outputs.
          if len(sample_weight) < len(y_true):
              sample_weight = [
                  sample_weight[0] for _ in range(len(y_true))
              ]
      else:
          sample_weight = [None for _ in range(len(y_true))]
      for m, y_t, y_p, s_w in zip(
          self._flat_weighted_metrics, y_true, y_pred, sample_weight
      ):
          if m:
              m.update_state(y_t, y_p, s_w)
  
imports: import tree
  from keras import backend
  from keras import losses
  from keras import metrics
  from keras import ops
  from keras.utils.naming import get_object_name
label_desc: Use image node_id 7 for calling the CompileMetrics obj's underlying member method code with example usage: obj.update_state(y_true, y_pred, sample_weight) without return types