XLA compiled `Embedding` could work for out-of-bound input
@YangChenyuan,
Apologies for the delay. I tried to execute the mentioned code on tf-nightly(2.16.0-dev20231101) and the code was executed without any issue/error and the respective outputs are also the same in both the cases. Kindly find the gist of it [here](https://colab.research.google.com/gist/tilakrayal/74a405b63752afb269015e829ad5a1b0/untitled1475.ipynb). 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/61938">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/61938">No</a>

### Issue type

Bug

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

Yes

### Source

source

### TensorFlow version

2.15.0-dev20230921

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

XLA compiled `Embedding` could work for out-of-bound input. In the following code, the model has an embedding layer using `tf.keras.layers.Embedding(64, 128)`, which means it has 64 possible tokens (usually representing words or items, indexed from 0 to 63).

The input to it is `tf.constant([64], dtype=tf.int32)`, which is out of range because 64 exceeds the highest valid token index 63.

If we run the model without XLA compilation, it will raise an error as expected. However, after XLA compilation, the model could process such invalid input.

### Standalone code to reproduce the issue

```shell
import tensorflow as tf
"""
XLA compiled
"""
class Model(tf.keras.Model):

    def __init__(self):
        super(Model, self).__init__()
        self.embedding = tf.keras.layers.Embedding(64, 128)

    @tf.function(jit_compile=True)
    def call(self, x1, x2):
        x3 = self.embedding(x1)
        return (x3 * x2)

tf.random.set_seed(42)
m = Model()
input_1 = tf.constant([64], dtype=tf.int32)
input_2 = tf.constant([[[[10.0]]]], dtype=tf.float32)
print(m(input_1, input_2))

"""
Without XLA
"""
class Model(tf.keras.Model):

    def __init__(self):
        super(Model, self).__init__()
        self.embedding = tf.keras.layers.Embedding(64, 128)

    def call(self, x1, x2):
        x3 = self.embedding(x1)
        return (x3 * x2)

tf.random.set_seed(42)
m = Model()
input_1 = tf.constant([64], dtype=tf.int32)
input_2 = tf.constant([[[[10.0]]]], dtype=tf.float32)
print(m(input_1, input_2))

"""
InvalidArgumentError: Exception encountered when calling layer 'embedding_4' (type Embedding).

{{function_node __wrapped__ResourceGather_device_/job:localhost/replica:0/task:0/device:CPU:0}} indices[0] = 64 is not in [0, 64) [Op:ResourceGather] name: 
"""
```


### Relevant log output

_No response_