我从教程这里下载了CIFAR10代码,并尝试运行教程。我使用以下命令运行它:
python cifar10_train.py
程序开始运行,并按预期下载数据文件。但是,在尝试打开输入文件时,它会失败并出现以下跟踪信息:
Traceback (most recent call last):
File "cifar10_train.py", line 120, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 43, in run
sys.exit(main(sys.argv[:1] + flags_passthrough))
File "cifar10_train.py", line 116, in main
train()
File "cifar10_train.py", line 63, in train
images, labels = cifar10.distorted_inputs()
File "/notebooks/Python Scripts/tensorflowModels/tutorials/image/cifar10/cifar10.py", line 157, in distorted_inputs
batch_size=FLAGS.batch_size)
File "/notebooks/Python Scripts/tensorflowModels/tutorials/image/cifar10/cifar10_input.py", line 161, in distorted_inputs
read_input = read_cifar10(filename_queue)
File "/notebooks/Python Scripts/tensorflowModels/tutorials/image/cifar10/cifar10_input.py", line 87, in read_cifar10
tf.strided_slice(record_bytes, [0], [label_bytes]), tf.int32)
TypeError: strided_slice() takes at least 4 arguments (3 given)
果然,当我调查代码时,在cifar10_input.py中有一个只有3个参数的strided_slice()调用:
tf.strided_slice(record_bytes, [0], [label_bytes])
虽然tensorflow文档确实指出必须至少有4个参数,但是为什么会出错呢?我已经下载了最新版的tensorflow(0.12)并且运行cifar代码的主分支。