Some `Check Failed` errors in `tf.raw_ops.MatrixSetDiagV3`
Hi @xl1043237213 ,

I have replicated the reported behaviour with tf-nightly and attached below is screenshot of same. Will check and keep you posted.

<img width="1512" alt="Screenshot 2024-04-15 at 9 44 40 AM" src="https://github.com/tensorflow/tensorflow/assets/116063290/98aadccb-1974-4611-99ce-f6f9227591e0">



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

Some `Check Failed` errors in `tf.raw_ops.MatrixSetDiagV3`, which causes the program to crash. See the colab link below for details.

### Standalone code to reproduce the issue

```shell
https://colab.research.google.com/drive/11e72xipp_lz6fHcp7bN2MQy3Kw5KqHpL?usp=sharing
```


### Relevant log output

```shell
# Check failed: d < dims() (1 vs. 1)
# Check failed: d < dims() (2 vs. 2)
```
