[英]Convert a TFDS dataset to tensorflow.examples.tutorials.mnist
Previously I got an error on以前我有一个错误
from tensorflow.examples.tutorials.mnist import input_data
because its no longer part of tensorflow 2.0 from tensorflow.examples.tutorials.mnist import input_data
因为它不再是 tensorflow 2.0 的一部分
I was suggested in this post to replace it with我在这篇文章中被建议将其替换为
import tensorflow_datasets as tfds
input_data = tfds.load(name="mnist", split=tfds.Split.TRAIN)
But now Im getting the error:但现在我收到错误:
Traceback (most recent call last):
File "GAN.py", line 79, in <module>
mnist = input_data.read_data_sets('../../MNIST_data', one_hot=True)
AttributeError: '_OptionsDataset' object has no attribute 'read_data_sets'
How can I convert input_data
to the right format to be able to use read_data_sets
from it?如何将
input_data
转换为正确的格式以便能够从中使用read_data_sets
?
As the library has changed for TF2.0 so are its functions.随着 TF2.0 库的变化,它的功能也发生了变化。 So,
read_data_sets
is not required and functioning.因此,不需要
read_data_sets
并且可以正常运行。 input_data
is already your dataset consisting dictionaries of image
and label
. input_data
已经是包含image
和label
字典的数据集。 Which you can access like您可以访问
image, label = input_data["image"], input_data["label"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.