An example of  `a batched of RaggedTensor(s) with rank 2` as sparse_ids for tf.nn.safe_/embedding_lookup_sparse?
@pmixer,
Thank you for reporting. Could you please elaborate about your Feature. Also, please specify the Use Case for this feature. Thank you!
 hi @tilakrayal , thank you for the followup.

In summary, the feature request is for pursuing a concrete example for what claimed in the doc  https://tensorflow.google.cn/api_docs/python/tf/nn/safe_embedding_lookup_sparse?hl=en saying use of RaggedTensors can yield higher performance.

Roughly speaking, we all know `embeddings = tf.nn.safe_embedding_lookup_sparse(embedding_matrix, lookup_ids)` works well when `lookup_ids` being `tf.SparseTensor`, but it's performance could still be improved, especially, for inference, as on-the-fly shape computation could lead to perf hit sometimes.

Thus, what I'm looking for is that hint in the doc, replacing `tf.SparseTensor` lookup ids to a batch of `tf.RaggedTensor`.

I tried several approaches, all do not work(unless I call RaggedTensor's to_sparse method to cast it to SparseTensor). That's why I come to look for a piece of sample code to show the correct way to achieve the stuff what got claimed in the doc.

BTW, high level keras API `tf.keras.layer.Embedding` makes the model accept tf.RaggedTensor as lookup ids, I just could not make it work for more fundamental `tf.nn.safe_embedding_lookup_sparse` API. More concretely, I had a piece of example code to show what I want if using keras:

```python
import tensorflow as tf
import tf2onnx

# Create a sample RaggedTensor of lookup IDs
input_data = tf.ragged.constant([[1, 2, 3], [4, 5], [6]])

# Define the Embedding layer
embedding_dim = 4
embedding_layer = tf.keras.layers.Embedding(input_dim=7, output_dim=embedding_dim)

# Build the model
inputs = tf.keras.Input(shape=(None,), dtype=tf.int32, ragged=True)
embedded_data = embedding_layer(inputs)
model = tf.keras.Model(inputs=inputs, outputs=embedded_data)

# Export the model as SavedModel
saved_model_path = "./saved_model"
tf.saved_model.save(model, saved_model_path)

# then tensorflow-onnx could be used for converting SavedModel to onnx
```

And what I'm looking for if how to feed RaggedTensor to lower level API, tf.nn.safe_embedding_lookup_sparse as input.
### Issue type

Feature Request

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

Yes

### Source

source

### TensorFlow version

2.12

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

Currently, on the document https://tensorflow.google.cn/api_docs/python/tf/nn/safe_embedding_lookup_sparse?hl=en, it got claimed that `use of RaggedTensors can yield higher performance.`, without concrete examples for showing how to do the work.

An example pls?

### Standalone code to reproduce the issue

```shell
I tried several approaches to feed a batch of RaggedTensor to embedding_lookup operator, all failed with `object has no attribute 'dense_shape'` error, we could explicitly call `.to_sparse` method of RaggedTensor, but again, it comes SparseTensor which could not bring any performance gain, right?

Pls show an example, thx!
```


### Relevant log output

_No response_