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

Converting to_tensorflow with variable-shape elements #28

Open
iliiliiliili opened this issue Apr 7, 2020 · 3 comments
Open

Converting to_tensorflow with variable-shape elements #28

iliiliiliili opened this issue Apr 7, 2020 · 3 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@iliiliiliili
Copy link
Collaborator

If dataset has different shapes of data of the same element, to_tensorflow dataset won't be able to return data.

@iliiliiliili iliiliiliili added the bug Something isn't working label Apr 7, 2020
@LukasHedegaard
Copy link
Owner

The issue with creating Tensorflow datasets, is that it needs a type_spec and and shape_spec. Currently, all elements are converted to a tf.Tensor (which needs same-size elements).
Tensorflow does have a RaggedTensor type, though, which we might be able to use. The question then is how to identify if a RaggedTensor is needed:

  1. The current implementation infers type_spec and and shape_spec by querying a single item, but if we want to do it without additional user effort, we would need to inspect multiple (how many?) items to determine if the type is variable-sized.

  2. Alternatively, we could let the user pass a parameter to indicate which items should be converted to RaggedTensors (or SparseTensors for spare data).

I think we should opt for solution 2

@iliiliiliili
Copy link
Collaborator Author

Alternatively, we could let the user pass a parameter to indicate which items should be converted to RaggedTensors (or SparseTensors for spare data).

I think, it is better. If user doesn't know if they should use it or not, running the code will show is there an error or not. Then, they just add this parameter to convert.

In scenario 1 we can't be sure if we don't traverse through all data, and it's costly.

@LukasHedegaard LukasHedegaard added the enhancement New feature or request label Apr 15, 2020
@LukasHedegaard
Copy link
Owner

Postpone until after v0.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants