Crash in `tf.raw_ops.ResizeNearestNeighbor/ResizeNearestNeighborGrad/ResizeArea/ResizeBicubic/ResizeBilinear`
isn't this because the tensor is too big for the ram ? if you reduce the size to 20000, 20000 it should output without the resource exhaustion error. > isn't this because the tensor is too big for the ram ? if you reduce the size to 20000, 20000 it should output without the resource exhaustion error.



> isn't this because the tensor is too big for the ram ? if you reduce the size to 20000, 20000 it should output without the resource exhaustion error.

If the size parameter is reduced to 20000, the code will not cause a crash; however, we recommend that the Tensorflow throws a runtime error when the requested memory exceeds the limit instead of continuing to request memory and triggering a crash. Hi @x0w3n ,
- I was able to reproduce the issue on Colab using TF v2.15 and TF-nightly ,Please find the [gist](https://colab.research.google.com/gist/Venkat6871/bc3456879f297ec177eab055a633b67f/69322_2-15-nightly-v.ipynb) here for reference.

Thank you!
### Issue type

Bug

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

Yes

### Source

source

### TensorFlow version

TensorFlow Nightly

### Custom code

Yes

### OS platform and distribution

Linux Ubuntu 22.04.3 LTS (x86_64)

### 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?

On specific input, these APIs will output "The session crashed because it took up all available RAM." The affected APIs are listed below:

1. tf.raw_ops.ResizeBilinear
2. tf.raw_ops.ResizeBicubic
3. tf.raw_ops.ResizeArea
4. tf.raw_ops.ResizeNearestNeighbor
5. tf.raw_ops.ResizeNearestNeighborGrad

### Standalone code to reproduce the issue

```shell
https://colab.research.google.com/drive/1a6B_lYMfENTbO4ifQMLYe8Hq6CHcc6hP?usp=sharing
```


### Relevant log output

```shell
Timestamp	Level	Message
Jun 6, 2024, 6:57:43 PM	WARNING	WARNING:root:kernel d0444564-3fb8-4d42-ac83-1338e6842d5a restarted
Jun 6, 2024, 6:57:43 PM	INFO	KernelRestarter: restarting kernel (1/5), keep random ports
Jun 6, 2024, 6:57:25 PM	WARNING	2024-06-06 10:57:25.421101: W external/local_tsl/tsl/framework/cpu_allocator_impl.cc:83] Allocation of 51536461872 exceeds 10% of free system memory.
Jun 6, 2024, 6:57:21 PM	WARNING	2024-06-06 10:57:21.507228: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Jun 6, 2024, 6:57:17 PM	WARNING	To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
Jun 6, 2024, 6:57:17 PM	WARNING	2024-06-06 10:57:17.995922: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
Jun 6, 2024, 6:56:13 PM	WARNING	WARNING:root:kernel d0444564-3fb8-4d42-ac83-1338e6842d5a restarted
Jun 6, 2024, 6:56:13 PM	INFO	KernelRestarter: restarting kernel (1/5), keep random ports
Jun 6, 2024, 6:55:56 PM	WARNING	2024-06-06 10:55:56.764126: W external/local_tsl/tsl/framework/cpu_allocator_impl.cc:83] Allocation of 103072923744 exceeds 10% of free system memory.
Jun 6, 2024, 6:55:52 PM	WARNING	2024-06-06 10:55:52.277507: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
```
