tf.raw_ops.ResourceScatterUpdate crash with abortion
Try this below

import tensorflow as tf
import numpy as np

init = np.random.rand(20).astype(np.float32)  # Convert to float32

resource = tf.Variable(init, dtype=tf.float32)
resource_var = resource.handle
indices = np.array([1, 3, 5], dtype=np.int32)

# Make sure the updates tensor has the correct shape: (len(indices),)
update = np.random.rand(len(indices)).astype(np.float32)  # Convert to float32

tf.raw_ops.ResourceScatterUpdate(resource=resource_var, indices=indices, updates=update)
Now, the 'updates' tensor has a shape that matches the size of the 'indices' tensor, and the error should be resolved. @trickiwoo Could you please let us know if the above workaround worked for you?
Thank you! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. Thanks for providing the workaround. However, in my understanding, crashes like this seem to be a vulnerability according to https://github.com/tensorflow/tensorflow/issues/60121#issuecomment-1485230826 I was able to reproduce the issue in Tensorflow 2.12, please find the attached Gist [here](https://gist.github.com/sachinprasadhs/028763a39c0f83e59f6a5ba2807fef8a). Thanks! @trickiwoo,
I tried to execute the mentioned code on tf-nightly and the code was executed with the error and also observed that the crash did not happen. And the same has been in the respective files. Kindly find the [gist](https://colab.research.google.com/gist/tilakrayal/58a438e3530de19720ef3cac0201383f/untitled1681.ipynb) for the [reference](https://colab.research.google.com/gist/tilakrayal/64c329a1db61dd97eaaffed5e04e2f54/untitled1682.ipynb).

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L22 

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/resource_variable_ops.cc#L1120

>  // Check data type of update and resource to scatter.
>     const DataType update_dtype = c->input(2).dtype();
>     OP_REQUIRES(c, v->tensor()->dtype() == update_dtype,
>                 errors::InvalidArgument(
>                     "DType of scatter resource and updates does not match."));

Thank you! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. 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/60147">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/60147">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

Yes

### Source

source

### Tensorflow Version

2.13.0-dev20230208

### Custom Code

Yes

### OS Platform and Distribution

_No response_

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

```shell
tf.raw_ops.ResourceScatterUpdate crash with abortion
```


### Standalone code to reproduce the issue

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

init = np.random.rand(20)
update = np.random.rand(20)

resource = tf.Variable(init, dtype=tf.float32)
resource_var = resource.handle
indices = np.array([1, 3, 5], dtype=np.int32)
tf.raw_ops.ResourceScatterUpdate(resource=resource_var, indices=indices, updates=update)
```


### Relevant log output

```shell
2023-03-28 11:39:22.735062: F tensorflow/core/framework/tensor.cc:770] Check failed: dtype() == expected_dtype (1 vs. 2) double expected, got float
Aborted (core dumped)
```
</details>