code: def test_custom_metric_function(self):
      def my_custom_metric(y_true, y_pred):
          return ops.mean(ops.square(y_true - y_pred), axis=-1)
  
      compile_metrics = CompileMetrics(
          metrics=[my_custom_metric],
          weighted_metrics=[],
      )
      y_true = np.array([[0.1, 0.2], [0.3, 0.4], [0.5, 0.6]])
      y_pred = np.array([[0.4, 0.1], [0.2, 0.6], [0.6, 0.1]])
      compile_metrics.build(y_true, y_pred)
      compile_metrics.update_state(y_true, y_pred, sample_weight=None)
      result = compile_metrics.result()
      self.assertIsInstance(result, dict)
      self.assertEqual(len(result), 1)
      self.assertTrue("my_custom_metric" in result)
  
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 5 for calling the TestCompileMetrics obj's underlying member method code with example usage: obj.test_custom_metric_function() and returns: ops