code: def test_reduction(self):
      y_true = np.array([1.0, 0.0, 1.0, 0.0])
      y_pred = np.array([0.1, 0.2, 0.3, 0.4])
  
      # No reduction
      loss_fn = ExampleLoss(reduction=None)
      loss = loss_fn(y_true, y_pred)
      self.assertEqual(backend.standardize_dtype(loss.dtype), "float32")
      self.assertAllClose((y_true - y_pred) ** 2, loss)
  
      # sum
      loss_fn = ExampleLoss(reduction="sum")
      loss = loss_fn(y_true, y_pred)
      self.assertEqual(backend.standardize_dtype(loss.dtype), "float32")
      self.assertAllClose(np.sum((y_true - y_pred) ** 2), loss)
  
      # sum_over_batch_size
      loss_fn = ExampleLoss(reduction="sum_over_batch_size")
      loss = loss_fn(y_true, y_pred)
      self.assertEqual(backend.standardize_dtype(loss.dtype), "float32")
      self.assertAllClose(np.sum((y_true - y_pred) ** 2) / 4, loss)
  
      # bad reduction
      with self.assertRaisesRegex(
          ValueError, "Invalid value for argument"
      ):
          ExampleLoss(reduction="abc")
  
imports: import numpy
  import pytest
  from keras import backend
  from keras import losses
  from keras import ops
  from keras import testing
  from keras.losses.loss import Loss
label_desc: Use image node_id 1 for calling the LossTest obj's underlying member method code with example usage: obj.test_reduction() without return types