How to get detailed information about the issue
Hi @pranavladkat ,

As the [document](https://www.tensorflow.org/xla/known_issues#tfvariable_on_a_different_device) says, int32 types are not comprehensively supported on GPUs. As a workaround, please try int64.
Alternatively, you could choose to explicitly place int32 variables on CPU, or just not specify any device at all and let TensorFlow's device placement select GPU where appropriate.
Please let us know if this works.

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/61458">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/61458">No</a>

### Issue type

Bug

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

No

### Source

binary

### TensorFlow version

2.12.1

### Custom code

No

### OS platform and distribution

Linux Ubuntu 18.04

### Mobile device

_No response_

### Python version

3.8

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

Cuda 11.8, Cudnn 8.9.2

### GPU model and memory

Nvidia A10

### Current behavior?

I'm getting following error while compiling the model with XLA:

```
OP_REQUIRES failed at xla_ops.cc:347 : INVALID_ARGUMENT: Trying to access resource Resource-3-at-0x55555dbbdfb0 located in device /job:localhost/replica:0/task:0/device:CPU:0 from device /job:localhost/replica:0/task:0/device:GPU:0
```

This issue is documented as XLA limitation [here](https://www.tensorflow.org/xla/known_issues#tfvariable_on_a_different_device), which seems reasonable, but the error message doesn't specify where this issue is coming from.

Is there any way to get more details on which variable is creating this issue?

### Standalone code to reproduce the issue

```shell
NA
```


### Relevant log output

_No response_