Session.run() /Tensor.eval() of Tensorflow 运行 疯狂了很长时间
Session.run() /Tensor.eval() of Tensorflow run for a crazy long time
我正在尝试按照 Convolutional Neural Networks 教程学习 tenforflow,但是当我试图弄清楚 cifar10_input.py
如何从 cifar-10-batches-bin
加载数据时,我遇到了一个问题 Tensor.eval()
执行很长时间或永远运行而没有结果。
代码是这样的:
import tensorflow as tf
from tensorflow.models.image.cifar10 import cifar10_input
filenames = ['/Users/me/Downloads/cifar-10-batches-bin/data_batch_1.bin']
filename_queue = tf.train.string_input_producer(filenames)
read_input = cifar10_input.read_cifar10(filename_queue)
reshaped_image = tf.cast(read_input.uint8image, tf.float32)
with tf.Session() as sess:
print reshaped_image.eval()
代码基本来自cifar10_input.py
,文件data_batch_1.bin
是
摘自cifar-10-binary.tar.gz
。
通常,我可以使用它的 eval()
方法观察张量。但是在这种情况下它持续运行的时间比以往任何时候都长(我等了将近一个小时,它仍然是运行)。我的代码有问题吗?
1) 作为基本完整性检查:ls -al /Users/me/Downloads/cifar-10-batches-bin/data_batch_1.bin
2) 不要忘记:
init = tf.initialize_all_variables()
sess.run(init)
3) tf.train.start_queue_runners()
(创建会话后)
可能是#3。 string_input_producer
向 QUEUE_RUNNERS
集合添加一个队列运行器,需要启动。
我正在尝试按照 Convolutional Neural Networks 教程学习 tenforflow,但是当我试图弄清楚 cifar10_input.py
如何从 cifar-10-batches-bin
加载数据时,我遇到了一个问题 Tensor.eval()
执行很长时间或永远运行而没有结果。
代码是这样的:
import tensorflow as tf
from tensorflow.models.image.cifar10 import cifar10_input
filenames = ['/Users/me/Downloads/cifar-10-batches-bin/data_batch_1.bin']
filename_queue = tf.train.string_input_producer(filenames)
read_input = cifar10_input.read_cifar10(filename_queue)
reshaped_image = tf.cast(read_input.uint8image, tf.float32)
with tf.Session() as sess:
print reshaped_image.eval()
代码基本来自cifar10_input.py
,文件data_batch_1.bin
是
摘自cifar-10-binary.tar.gz
。
通常,我可以使用它的 eval()
方法观察张量。但是在这种情况下它持续运行的时间比以往任何时候都长(我等了将近一个小时,它仍然是运行)。我的代码有问题吗?
1) 作为基本完整性检查:ls -al /Users/me/Downloads/cifar-10-batches-bin/data_batch_1.bin
2) 不要忘记:
init = tf.initialize_all_variables()
sess.run(init)
3) tf.train.start_queue_runners()
(创建会话后)
可能是#3。 string_input_producer
向 QUEUE_RUNNERS
集合添加一个队列运行器,需要启动。