问题描述
TensorFlow MNIST 示例未与fully_connected_feed.py 一起运行
我检查了这个并意识到 input_data
不是内置的.所以我从这里.如何开始本教程:
I checked this out and realized that input_data
was not built-in. So I downloaded the whole folder from here. How can I start the tutorial:
import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-6-a5af65173c89> in <module>()
----> 1 import input_data
2 mnist = tf.input_data.read_data_sets("MNIST_data/", one_hot=True)
ImportError: No module named input_data
我正在使用 iPython (Jupyter),所以我需要将我的工作目录更改为我下载的这个文件夹吗?或者我可以将它添加到我的 tensorflow
目录中吗?如果是这样,我在哪里添加文件?我用 pip
(在我的 OSX 上)安装了 tensorflow
,当前位置是 ~/anaconda/lib/python2.7/site-packages/tensorflow/__init__.py
I'm using iPython (Jupyter) so do I need to change my working directory to this folder I downloaded? or can I add this to my tensorflow
directory? If so, where do I add the files? I installed tensorflow
with pip
(on my OSX) and the current location is ~/anaconda/lib/python2.7/site-packages/tensorflow/__init__.py
这些文件是否应该像 sklearn
数据集一样通过 tensorflow
直接访问?还是我只是应该 cd 进入目录并从那里开始工作?例子不清楚.
Are these files meant to be accessed directly through tensorflow
like sklearn
datasets? or am I just supposed to cd into the directory and work from there? The example is not clear.
这篇文章已经过时了
推荐答案
所以让我们假设您在目录中:/somePath/tensorflow/tutorial
(这是您的工作目录).
So let's assume that you are in the directory: /somePath/tensorflow/tutorial
(and this is your working directory).
您需要做的就是下载input_data.py 文件并像这样放置.让我们假设您调用的文件名:
All you need to do is to download the input_data.py file and place it like this. Let's assume that the file name you invoke:
import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
...
是 main.py
并且它也在同一目录中.
is main.py
and it is also in the same directory.
一旦完成,您就可以开始运行 main.py
这将开始下载文件并将它们放在 MNIST_data 文件夹中(一旦它们在那里,脚本将不会在下一次下载它们时间).
Once this is done, you can just start running main.py
which will start downloading the files and will put them in the MNIST_data folder (once they are there the script will not be downloading them next time).
这篇关于导入 input_data MNIST 张量流不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!