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

Cannot iterate over a scalar tensor. with split_dataset #17

Open
mihalt opened this issue Sep 10, 2023 · 4 comments
Open

Cannot iterate over a scalar tensor. with split_dataset #17

mihalt opened this issue Sep 10, 2023 · 4 comments
Assignees

Comments

@mihalt
Copy link

mihalt commented Sep 10, 2023

I try to use something like:

sentences = tf.data.TextLineDataset('/path/to/sentences.txt')
train_s, test_s = tf.keras.utils.split_dataset(data_zipped, left_size=0.98)

And get error like
Cannot iterate over a scalar tensor.

So, is it real to use your util with simple 1D arrays?

@sushreebarsa
Copy link
Contributor

@mihalt Could you please provide the complete standalone code to replicate this issue?
Thank you!

@mihalt
Copy link
Author

mihalt commented Sep 12, 2023

@mihalt Could you please provide the complete standalone code to replicate this issue? Thank you!

https://colab.research.google.com/drive/1jX51PI_7Q7WJIWL6OfLkjWurC6AZkDuf?usp=sharing

@divyashreepathihalli
Copy link
Contributor

Hi Mihalt, What is the content of your sentences.txt? Looks like only one value is being read from the file and you cannot iterate over one scalar tensor because there is nothing to iterate over.

@SouSingh
Copy link

hey, @mihalt I did some research with your colab notebook and I got this one solvable. I hope this one solves your problem.
Screenshot (109)

@sachinprasadhs sachinprasadhs transferred this issue from keras-team/keras Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants