Datasets: Trying to run the code and get an error message

Created on 3 Jul 2019  路  7Comments  路  Source: tensorflow/datasets

Short description
Description of the bug.

Environment information

  • Operating System:
  • Python version:
  • tensorflow-datasets/tfds-nightly version:
  • tensorflow/tensorflow-gpu/tf-nightly/tf-nightly-gpu version:

Reproduction instructions

<put a code snippet or link to a gist here>

mnist_example, = mnist_train.take(1)
image, label = mnist_example["image"], mnist_example["label"]

plt.imshow(image.numpy()[:, :, 0].astype(np.float32), cmap=plt.get_cmap("gray"))
print("Label: %d" % label.numpy())
Link to logs

ValueError Traceback (most recent call last)
in ()
----> 1 mnist_example, = mnist_train.take(1)
2 image, label = mnist_example["image"], mnist_example["label"]
3
4 plt.imshow(image.numpy()[:, :, 0].astype(np.float32), cmap=plt.get_cmap("gray"))
5 print("Label: %d" % label.numpy())

ValueError: too many values to unpack (expected 1)
Expected behavior
What you expected to happen.

Additional context
Add any other context about the problem here.

bug

All 7 comments

It might be TF related. Which tensorflow version are you using ?

print(tf.__version__)

You can also verify the code in the colab (that runs 1.14):
https://colab.research.google.com/github/tensorflow/datasets/blob/master/docs/overview.ipynb

Hi -,

Thanks! Actually, I got the error message while I was running the notebook in the colab.

2019-07-04_053550_1

@yupliu I just checked but didn't find any errors.

I think the error message is caused by this line tf.enable_eager_execution(). Yesterday, when I ran it, I failed and got some wierd error.

I just tried again and it worked. As long as tf.enable_eager_execution() is executed sucessfully the error message go away.

tf.enable_eager_execution() must be executed at the start of the program.
Yes, I saw that if u do not execute tf.enable_eager_execution() you get the exact same error. Try restarting runtime and run again.

Hey @yupliu,
Please check this link about eager execution.

If your problem is solved you can close this issue :)

Thanks!

Was this page helpful?
0 / 5 - 0 ratings