Unexpected outputs from MaxPooling2D layer

**System information**.
- Have I written custom code (as opposed to using a stock example script provided in Keras): Yes
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Google Colab
- TensorFlow installed from (source or binary): pip install
- TensorFlow version (use command below): 2.8.0
- Python version: 3.7.12
- Bazel version (if compiling from source):
- GPU model and memory: using CPU
- Exact command to reproduce: 

```
input_shape = (10,10,32,256)
x = keras.layers.Input(input_shape[1:])
layer_stack = [
keras.layers.MaxPooling2D(pool_size=(2,2), padding="same", strides=(2,2)),
]
layer_input = x
for layer in layer_stack:
  y = layer(layer_input)
  layer_input = y

model = keras.Model(x,y)
model.summary()
import numpy as np
x = np.random.rand(*input_shape)
x[:] = np.NaN
res = model.predict(x)
```

**Describe the problem**.
MaxPooling2D layer does not give correct results for NaN inputs.

**Describe the current behavior**.
MaxPooling2D layer outputs a matrix of large negative values, i.e. `-3.4028235e+38` when a matrix of NaN is passed as inputs.

**Describe the expected behavior**.
Normally in max pooling, maximum value of patches of an input is output. And in the case of NaN matrix as inputs, outputs should be a matrix of NaN.

**[Contributing](https://github.com/keras-team/keras/blob/master/CONTRIBUTING.md)**.

- Do you want to contribute a PR? (yes/no): no
- If yes, please read [this page](https://github.com/keras-team/keras/blob/master/CONTRIBUTING.md) for instructions
- Briefly describe your candidate solution(if contributing):

**Standalone code to reproduce the issue**.


https://colab.research.google.com/drive/13SEcY5Lzj9fLQTv-JSNWA7cgnirNWnh6?usp=sharing#scrollTo=gZUgM5985nJs



diff --git a/keras/engine/training.py b/keras/engine/training.py
index 70b44fab78..7285a00336 100644
--- a/keras/engine/training.py
+++ b/keras/engine/training.py
@@ -1962,6 +1962,10 @@ class Model(base_layer.Layer, version_utils.ModelVersionSelector):
     """
     base_layer.keras_api_gauge.get_cell('predict').set(True)
     version_utils.disallow_legacy_graph('Model', 'predict')
+    if tf_utils.np.isnan(x).any() or tf_utils.np.isinf(x).any():
+      raise ValueError(
+          f'Unsupported input data format. Received: {tf_utils.np.sum(x)} in '
+          'input data. Was expecting a numeric data.')
     self._check_call_args('predict')
     _disallow_inside_tf_function('predict')
 
['keras/engine/training.py']