code: def test_dict_output_case(self):
      compile_metrics = CompileMetrics(
          metrics={
              "output_1": [
                  metrics_module.MeanSquaredError(),
                  metrics_module.MeanSquaredError(name="mse"),
              ],
              "output_2": [
                  metrics_module.MeanSquaredError(),
                  metrics_module.MeanSquaredError(name="mse"),
              ],
          },
          weighted_metrics={
              "output_1": [
                  metrics_module.MeanSquaredError(),
                  metrics_module.MeanSquaredError(name="mse"),
              ],
              "output_2": [
                  metrics_module.MeanSquaredError(),
                  metrics_module.MeanSquaredError(name="mse"),
              ],
          },
      )
      # Test symbolic build
      y_true = {
          "output_1": backend.KerasTensor((3, 4)),
          "output_2": backend.KerasTensor((3, 4)),
      }
      y_pred = {
          "output_1": backend.KerasTensor((3, 4)),
          "output_2": backend.KerasTensor((3, 4)),
      }
      compile_metrics.build(y_true, y_pred)
      # Test eager build
      y_true = {
          "output_1": np.array([[0.1, 0.2], [0.3, 0.4], [0.5, 0.6]]),
          "output_2": np.array([[0.1, 0.2], [0.3, 0.4], [0.5, 0.6]]),
      }
      y_pred = {
          "output_1": np.array([[0.4, 0.1], [0.2, 0.6], [0.6, 0.1]]),
          "output_2": np.array([[0.4, 0.1], [0.2, 0.6], [0.6, 0.1]]),
      }
      sample_weight = np.array([1, 0.0, 1])
      compile_metrics.build(y_true, y_pred)
  
      # Test update / result / reset flow
      compile_metrics.update_state(
          y_true, y_pred, sample_weight=sample_weight
      )
      y_pred = {
          "output_1": np.array([[0.3, 0.2], [0.1, 0.4], [0.2, 0.3]]),
          "output_2": np.array([[0.3, 0.2], [0.1, 0.4], [0.2, 0.3]]),
      }
      compile_metrics.update_state(
          y_true, y_pred, sample_weight=sample_weight
      )
      result = compile_metrics.result()
      self.assertIsInstance(result, dict)
      self.assertEqual(len(result), 8)
      # Result values obtained from `tf.keras`
      # m = tf.keras.metrics.MeanSquaredError()
      # m.update_state(y_true, y_pred1, sample_weight=weight)
      # m.update_state(y_true, y_pred2, sample_weight=weight)
      # m.result().numpy()
      self.assertAllClose(
          result["output_1_mean_squared_error"], 0.055833336
      )
      self.assertAllClose(
          result["output_2_mean_squared_error"], 0.055833336
      )
      self.assertAllClose(result["output_1_mse"], 0.055833336)
      self.assertAllClose(result["output_2_mse"], 0.055833336)
      self.assertAllClose(
          result["output_1_weighted_mean_squared_error"], 0.0725
      )
      self.assertAllClose(
          result["output_2_weighted_mean_squared_error"], 0.0725
      )
      self.assertAllClose(result["output_1_weighted_mse"], 0.0725)
      self.assertAllClose(result["output_2_weighted_mse"], 0.0725)
  
      compile_metrics.reset_state()
      result = compile_metrics.result()
      self.assertIsInstance(result, dict)
      self.assertEqual(len(result), 8)
      self.assertAllClose(result["output_1_mean_squared_error"], 0.0)
      self.assertAllClose(result["output_2_mean_squared_error"], 0.0)
      self.assertAllClose(
          result["output_1_weighted_mean_squared_error"], 0.0
      )
      self.assertAllClose(
          result["output_2_weighted_mean_squared_error"], 0.0
      )
  
imports: import numpy
  from absl.testing import parameterized
  from keras import backend
  from keras import metrics
  from keras import metrics
  from keras import ops
  from keras import testing
  from keras.trainers.compile_utils import CompileLoss
  from keras.trainers.compile_utils import CompileMetrics
label_desc: Use image node_id 3 for calling the TestCompileMetrics obj's underlying member method code with example usage: obj.test_dict_output_case() without return types