docstr: Update metric states and collect all metrics to be returned.
  
  Subclasses can optionally override this method to provide custom metric
  updating and collection logic.
  
  Example:
  
  ```python
  class MyModel(Sequential):
      def compute_metrics(self, x, y, y_pred, sample_weight):
          # This super call updates `self.compiled_metrics` and returns
          # results for all metrics listed in `self.metrics`.
          metric_results = super().compute_metrics(
              x, y, y_pred, sample_weight)
  
          # Note that `self.custom_metric` is not listed
          # in `self.metrics`.
          self.custom_metric.update_state(x, y, y_pred, sample_weight)
          metric_results['metric_name'] = self.custom_metric.result()
          return metric_results
  ```
  
  Args:
      x: Input data.
      y: Target data.
      y_pred: Predictions returned by the model output of `model.call(x)`.
      sample_weight: Sample weights for weighting the loss function.
  
  Returns:
      A `dict` containing values that will be passed to
      `keras.callbacks.CallbackList.on_train_batch_end()`. Typically,
      the values of the metrics listed in `self.metrics` are returned.
      Example: `{'loss': 0.2, 'accuracy': 0.7}`.
code: def compute_metrics(self, x, y, y_pred, sample_weight=None):
      """Update metric states and collect all metrics to be returned.
  
      Subclasses can optionally override this method to provide custom metric
      updating and collection logic.
  
      Example:
  
      ```python
      class MyModel(Sequential):
          def compute_metrics(self, x, y, y_pred, sample_weight):
              # This super call updates `self.compiled_metrics` and returns
              # results for all metrics listed in `self.metrics`.
              metric_results = super().compute_metrics(
                  x, y, y_pred, sample_weight)
  
              # Note that `self.custom_metric` is not listed
              # in `self.metrics`.
              self.custom_metric.update_state(x, y, y_pred, sample_weight)
              metric_results['metric_name'] = self.custom_metric.result()
              return metric_results
      ```
  
      Args:
          x: Input data.
          y: Target data.
          y_pred: Predictions returned by the model output of `model.call(x)`.
          sample_weight: Sample weights for weighting the loss function.
  
      Returns:
          A `dict` containing values that will be passed to
          `keras.callbacks.CallbackList.on_train_batch_end()`. Typically,
          the values of the metrics listed in `self.metrics` are returned.
          Example: `{'loss': 0.2, 'accuracy': 0.7}`.
      """
      del x  # The default implementation does not use `x`.
      if self._compile_metrics is not None:
          self._compile_metrics.update_state(y, y_pred, sample_weight)
      return self.get_metrics_result()
  
imports: import platform
  import warnings
  import tree
  from keras import backend
  from keras import metrics
  from keras import ops
  from keras import optimizers
  from keras.optimizers.loss_scale_optimizer import LossScaleOptimizer
  from keras.saving import serialization_lib
  from keras.trainers.compile_utils import CompileLoss
  from keras.trainers.compile_utils import CompileMetrics
  from keras.trainers.data_adapters import data_adapter_utils
  from keras.utils import traceback_utils
  from keras.utils import tracking
label_desc: Use image node_id 13 for calling the Trainer obj's underlying member method code with example usage: obj.compute_metrics(x, y, y_pred, sample_weight) and returns: self