Aborted (core dumped) in `tf.compat.v1.image.draw_bounding_boxes`
@x0w3n  I tried to replicate the issue reported using tf-nightly and faced the following error rather than core dumped issue. 
```
InvalidArgumentError: {{function_node __wrapped__DrawBoundingBoxesV2_device_/job:localhost/replica:0/task:0/device:CPU:0}} The rank of the images should be 4 [Op:DrawBoundingBoxesV2] name: 
```
Please find the gist [here](https://colab.research.google.com/gist/sushreebarsa/9dc92a428a14abd9e3a433dd95ab5d39/69232.ipynb#scrollTo=YUSZ3wQ5a9HV).
Thank you! 
### Issue type

Bug

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

No

### Source

source

### TensorFlow version

tf 2.16

### Custom code

Yes

### OS platform and distribution

Linux Ubuntu 22.04.3 LTS (x86_64)

### Mobile device

_No response_

### Python version

3.9.13

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

A crash is triggered when tf.compat.v1.image.draw_bounding_boxes is given a specific input, the APIs affected by this are as follows：

1. tf.compat.v1.image.draw_bounding_boxes(images, boxes, colors=colors)
2. tf.raw_ops.DrawBoundingBoxesV2(images=images, boxes=boxes, colors=colors)
3. tf.raw_ops.DrawBoundingBoxes(images=images, boxes=boxes)
4. tf.image.draw_bounding_boxes(images, boxes, colors=colors)

### Standalone code to reproduce the issue

```shell
import tensorflow as tf
import numpy as np

images = tf.random.normal(shape=(2, 3, 4))
boxes = tf.random.normal(shape=(2, 2, 4))
colors = tf.random.normal(shape=(2, 4))

result = tf.compat.v1.image.draw_bounding_boxes(images, boxes, colors=colors)
# crash
# output = tf.raw_ops.DrawBoundingBoxesV2(images=images, boxes=boxes, colors=colors)
# crash
# output = tf.raw_ops.DrawBoundingBoxes(images=images, boxes=boxes)
# crash 
# result = tf.image.draw_bounding_boxes(images, boxes, colors=colors)
```


### Relevant log output

```shell
2024-06-05 12:32:06.850044: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-06-05 12:32:07.838677: F tensorflow/core/framework/tensor_shape.cc:357] Check failed: d < dims() (3 vs. 3)
Aborted (core dumped)
```
