code: def reduce_values(values, reduction="sum_over_batch_size"):
      if (
          reduction is None
          or reduction == "none"
          or tuple(values.shape) == ()
          or tuple(values.shape) == (0,)
      ):
          return values
      loss = ops.sum(values)
      if reduction == "sum_over_batch_size":
          loss /= ops.cast(
              ops.prod(
                  ops.convert_to_tensor(
                      ops.shape(values), dtype="int32"
                  )
              ),
              loss.dtype,
          )
      return loss
  
file_path: keras/keras/losses/loss.py
imports: import tree
  from keras import backend
  from keras import ops
  from keras.api_export import keras_export
  from keras.utils.naming import auto_name
label_desc: Use image node_id 3 for calling a global function with example usage: reduce_values(values, reduction) and returns: loss, values