A check fail can be triggered in tf.raw_ops.ResourceSparseApplyKerasMomentum
### Issue type

Bug

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

Yes

### Source

binary

### TensorFlow version

tf 2.15

### Custom code

Yes

### OS platform and distribution

Ubuntu 20.04

### Mobile device

_No response_

### Python version

3.9

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

In the latest version of TensorFlow, the following code can trigger a crash in `tf.raw_ops.ResourceSparseApplyKerasMomentum` due to check-fail.

### Standalone code to reproduce the issue

```shell
import tensorflow as tf

var = tf.Variable([[1.0, 2.0], [3.0, 4.0]], dtype=tf.complex64)  
accum = tf.Variable([[0.1, 0.2], [0.3, 0.4]])
lr = 0.01
grad = tf.constant([[0.1, 0.2], [0.3, 0.4]])
indices = tf.constant([0, 1])  
momentum = 0.9

result = tf.raw_ops.ResourceSparseApplyKerasMomentum(var=var.handle, accum=accum.handle, lr=lr, grad=grad, indices=indices, momentum=momentum)

print(result)
```


### Relevant log output

```shell
2024-03-14 15:57:08.452454: F tensorflow/core/framework/tensor.cc:844] Check failed: dtype() == expected_dtype (8 vs. 1) float expected, got complex64
Aborted (core dumped)
```
