Repository: tensorflow
Issue: Process aborted when running `tf.keras.layers.MaxPooling1D` on GPU with large `pool_size`
Labels: stat:awaiting tensorflower,type:bug,comp:apis,TF 2.13

### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

Yes

### Source

binary

### TensorFlow version

2.14.0-rc1

### Custom code

No

### 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?

Process aborted with Check failed error when running `tf.keras.layers.MaxPooling1D` on GPU with large `pool_size`, while it throws an Exception on CPU.
When I reduce the `pool_size_0` to `1e+18`, it throws an Exception on GPU, which is a more reasonable behavior I think.
This behavior is similar to what described in #61642, which also throws a Check failed error by using a large `pool_size` for `tf.compat.v1.layers.MaxPooling1D` on GPU.


### Standalone code to reproduce the issue

```python
import tensorflow as tf
print(tf.version.GIT_VERSION, tf.version.VERSION, flush=True)

try:
    pool_size_0 = 1e+19
    pool_size = [pool_size_0,]
    strides_0 = 2
    strides = [strides_0,]
    padding = "same"
    data_format = "channels_last"
    arg_class = tf.keras.layers.MaxPooling1D(pool_size=pool_size,strides=strides,padding=padding,data_format=data_format,)
    # arg_class = tf.keras.layers.MaxPool1D(pool_size=pool_size,strides=strides,padding=padding,data_format=data_format,)
    # arg_class = tf.compat.v1.keras.layers.MaxPooling1D(pool_size=pool_size,strides=strides,padding=padding,data_format=data_format,)
    # arg_class = tf.compat.v1.keras.layers.MaxPool1D(pool_size=pool_size,strides=strides,padding=padding,data_format=data_format,)
    arg_input_0_tensor = tf.random.uniform([1, 5, 4], dtype=tf.float32)
    arg_input_0 = tf.identity(arg_input_0_tensor)
    arg_input = [arg_input_0,]
    out = arg_class(*arg_input)
except Exception as e:
    print("Error:", str(e), flush=True)
print("Success!", flush=True)
```


### Relevant log output

On GPU, it throws a Check failed and core dumped.

```text
v2.14.0-rc0-34-gdd01672d9a9 2.14.0-rc1
2023-09-03 11:34:09.267078: I tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:442] Loaded cuDNN version 8600
2023-09-03 11:34:09.267132: F tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:1019] Check failed: cudnnSetPoolingNdDescriptor( handle_.get(), (pooling_descriptor.mode() == dnn::PoolingMode::kMaximum ? cudnn_max_pooling_mode : CUDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING), propagate_nans ? CUDNN_PROPAGATE_NAN : CUDNN_NOT_PROPAGATE_NAN, nd, shape.data(), padding.data(), strides.data()) == CUDNN_STATUS_SUCCESS (3 vs. 0)
Aborted (core dumped)
```

On CPU, it throws a Exception.

```text
v2.14.0-rc0-34-gdd01672d9a9 2.14.0-rc1
Error: Exception encountered when calling layer 'max_pooling1d' (type MaxPooling1D).

{{function_node __wrapped__MaxPool_device_/job:localhost/replica:0/task:0/device:CPU:0}} Sliding window ksize for dimension 1 was zero. [Op:MaxPool]

Call arguments received by layer 'max_pooling1d' (type MaxPooling1D):
  • inputs=tf.Tensor(shape=(1, 5, 4), dtype=float32)
Success!
```

When I change the `pool_size_0` to `1e+18`, it throws a Exception on GPU.

```text
v2.14.0-rc0-34-gdd01672d9a9 2.14.0-rc1
2023-09-03 11:51:28.441325: W tensorflow/core/framework/op_kernel.cc:1816] OP_REQUIRES failed at maxpooling_op.cc:1260 : INVALID_ARGUMENT: Attr ksize has value 1000000000000000000 out of range for an int32
Error: Exception encountered when calling layer 'max_pooling1d' (type MaxPooling1D).

{{function_node __wrapped__MaxPool_device_/job:localhost/replica:0/task:0/device:GPU:0}} Attr ksize has value 1000000000000000000 out of range for an int32 [Op:MaxPool]

Call arguments received by layer 'max_pooling1d' (type MaxPooling1D):
  • inputs=tf.Tensor(shape=(1, 5, 4), dtype=float32)
Success!
```