Float32 precision loss causing cross_entropy loss to return incorrect results
@cui-83 can you try calculating the loss directly from logits? 
From what I understand this is advised to do exactly for this reason. @maksym33 
Indeed the symmetry is preserved when using logits:
```
>>> K.binary_crossentropy([[0.0],[1.0]],[[9.99],[-9.99]], from_logits=True)
<tf.Tensor: shape=(2, 1), dtype=float32, numpy=
array([[9.990046],
       [9.990046]], dtype=float32)>
```
That's because 
```
  if from_logits:
    return nn.sigmoid_cross_entropy_with_logits(labels=target, logits=output)
```
The calculation without logits is still problematic nevertheless. I don't see a simple solution but replacing epsilon with a bigger value (e.g., 1e-6) help alleviate the problem a little. Hello, @cui-83!
Sorry for the late response!
Float32 precision has a limited range of re-presentable values, and when dealing with large numbers, the loss calculations can overflow or underflow, resulting in inaccurate values which are intended. Could you please try to use higher precision data types like Float64 or BFloat16 with the latest TF version for the loss calculations to avoid such issues ?
Thank you! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62204">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62204">No</a>

### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

Yes

### Source

source

### TensorFlow version

tf 2.8

### Custom code

Yes

### OS platform and distribution

_No response_

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

```
import tensorflow.keras.backend as K
K.binary_crossentropy([[0.0],[1.0]],[[1.0],[0.0]], from_logits=False)
<tf.Tensor: shape=(2, 1), dtype=float32, numpy=
array([[15.333239],
       [15.424949]], dtype=float32)>
```
In theory, crossentropy isn't symmetric but the non-trivial discrepancy between crossentropy(0,1) and crossentropy(1,0) here is caused by precision loss. Specifically, 
In https://github.com/tensorflow/tensorflow/blob/v2.3.0/tensorflow/python/keras/backend.py#L4825C67-L4825C67
```
epsilon_ = _constant_to_tensor(epsilon(), output.dtype.base_dtype)
output = clip_ops.clip_by_value(output, epsilon_, 1. - epsilon_)

bce = target * math_ops.log(output + epsilon())
bce += (1 - target) * math_ops.log(1 - output + epsilon())
return -bce
```
The problem is, when output==1, 1 - output + epsilon() = 1 - (1. - epsilon_) + epsilon() = 2* epsilon_
the expected result should be 2e-7, but the actual result is 2.1920928e-07 due to precision loss. After taking the natural log, we get 15.333239 and 15.424949. A 0.092 difference in a single sample loss is pretty significant.

### Standalone code to reproduce the issue

```shell
import tensorflow.keras.backend as K
K.binary_crossentropy([[0.0],[1.0]],[[1.0],[0.0]], from_logits=False)
```


### Relevant log output

```shell
<tf.Tensor: shape=(2, 1), dtype=float32, numpy=array([[15.333239],  [15.424949]], dtype=float32)>
```
