Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I specify a ragged tensor as an input object in a sequential model (Keras v3) #20576

Open
fninsiima opened this issue Dec 2, 2024 · 2 comments
Assignees
Labels

Comments

@fninsiima
Copy link

I am following the object detection tutorial with yolov8 and kerascv

However, instead of using yolo for object detection, I would like to use a custom sequential model.

My roadblock is at the point of defining the input layer. I would like it to take in a ragged tensor.

According to the keras v2 docs, there is an option to specify ragged=True and define the input layer via inputs = tf.keras.Input(shape = [] , dtype = tf.int64, ragged = True)

However in keras v3, the ragged option has been removed.

So how do I proceed with defining an input layer that takes in a ragged tensor?

@fchollet
Copy link
Collaborator

fchollet commented Dec 4, 2024

There is no ragged tensor support in Keras 3 at this time. Ragged tensors are a TF-only concept (it doesn't exist in JAX or PyTorch) and it is incompatible with XLA, which is the default compiler when using the TF backend in Keras 3.

In general my recommendation is that you can have ragged tensors in your input preprocessing pipeline, but by the time you hit the model you need to densify / pad your tensors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@fchollet @fninsiima @mehtamansi29 and others