mixed_float16 in Keras example stops the model to learn
@To3No7,
Thank you for opening this issue. Development of keras moved to another [repository](https://github.com/keras-team/keras/issues). 

Could you please post this issue on keras-team/keras [repo](https://github.com/keras-team/keras/issues).
To know more please refer:
https://discuss.tensorflow.org/t/keras-project-moved-to-new-repository-in-https-github-com-keras-team-keras/1999
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/59826">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/59826">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

Yes

### Source

source

### Tensorflow Version

TensorFlow version: 2.11.0 as well as 2.13.0-dev20230227

### Custom Code

Yes

### OS Platform and Distribution

Colab & Ubuntu 22.04

### Mobile device

_No response_

### Python version

3.9

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

Colab & 12.0

### GPU model and memory

T4 & 3090

### Current Behaviour?

```shell
If I run the Keras vision example forwardforward from:
https://keras.io/examples/vision/forwardforward/ 
in Colab or on a Local Machine with 3090 and turn on mixed_float16 with the code
´´´
gpu_devices = tf.config.list_physical_devices('GPU')
if gpu_devices:
 details = tf.config.experimental.get_device_details(gpu_devices[0])
 compute_capability=details.get('compute_capability')
 print("Compute capability:",compute_capability)
 if compute_capability[0]>6:
   print("Turning on mixed_float16")
   policy = tf.keras.mixed_precision.Policy('mixed_float16')
   tf.keras.mixed_precision.set_global_policy(policy)
´´´

Then the model no longer trains

When running 
history = model.fit(train_dataset, epochs=epochs)

In mixed_float16 one gets 
1/1 [==============================] - 49s 49s/step - FinalLoss: 0.9510
Epoch 2/250
1/1 [==============================] - 1s 1s/step - FinalLoss: 0.9510
Epoch 3/250
1/1 [==============================] - 1s 1s/step - FinalLoss: 0.9510
Epoch 4/250
1/1 [==============================] - 1s 1s/step - FinalLoss: 0.9510
…
Epoch 250/250
1/1 [==============================] - 1s 1s/step - FinalLoss: 0.9510

Clearly not training!

While without mixed_float16 one gets something like:
1/1 [==============================] - 45s 45s/step - FinalLoss: 0.7278
Epoch 2/250
1/1 [==============================] - 2s 2s/step - FinalLoss: 0.7081
Epoch 3/250
1/1 [==============================] - 2s 2s/step - FinalLoss: 0.7011
Epoch 4/250
…
Epoch 250/250
1/1 [==============================] - 2s 2s/step - FinalLoss: 0.3117


This can be reproduced by turning on the mixed_float16 according to the code above in the colab notebook https://colab.research.google.com/github/keras-team/keras-io/blob/master/examples/vision/ipynb/forwardforward.ipynb
```


### Standalone code to reproduce the issue

```shell
https://colab.research.google.com/drive/1U0-NXNjyh6onGsGmiTfoqkX-1rNgoTuq?usp=sharing
```


### Relevant log output

_No response_</details>