`Overflow` in `tf.compat.v1.nn.ctc_loss` and `tf.compat.v1.nn.ctc_loss_v2` when there are too large values in `labels`.
Hi @xl1043237213 ,

I have replicated the reported behaviour and attached screenshot below. The overflow warning is expected but it follows a crash which might needs fix.

<img width="1485" alt="Screenshot 2024-04-17 at 11 38 46 AM" src="https://github.com/tensorflow/tensorflow/assets/116063290/a7ec7fa2-780d-4d37-8f33-739bd678fb97">

### Issue type

Bug

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

Yes

### Source

binary

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

`Overflow` in `tf.compat.v1.nn.ctc_loss` and `tf.compat.v1.nn.ctc_loss_v2` when the value of `labels` is too large. See the colab link below for details.

### Standalone code to reproduce the issue

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


### Relevant log output

```shell
Non-OK-status: InitDims(dim_sizes) status: INVALID_ARGUMENT: Encountered overflow when multiplying 2 with 9143586203607084488, result: -159571666495382640
```
