`Check failed` in `tf.raw_ops.GatherV2` when the value of `axis` is too large.
Hi @xl1043237213 ,

I have replicated the reported behaviour and attached screenshot below. Need to check the root cause.

<img width="1506" alt="Screenshot 2024-04-17 at 11 30 33 AM" src="https://github.com/tensorflow/tensorflow/assets/116063290/3fdc52a6-80b8-41e3-af37-42bb4447840a">
 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/65869">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/65869">No</a>

### Issue type

Bug

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

Yes

### Source

source

### TensorFlow version

tf 2.15

### Custom code

No

### OS platform and distribution

Linux Ubuntu 20.04

### Mobile device

_No response_

### Python version

3.10

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

`Check failed` in `tf.raw_ops.GatherV2` when the value of `axis` is too large.

### Standalone code to reproduce the issue

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


### Relevant log output

```shell
Check failed: d >= 0 (0 vs. -1)
```
