为什么张量流中的cnn教程不起作用?

时间:2017-07-03 13:36:41

标签: tensorflow

我尝试测试本教程https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/layers/cnn_mnist.py关于卷积神经网络,有人解释,但我发现了这个错误:

Traceback (most recent call last):
  File "Convolution_Neural_Network.py", line 161, in <module>
    tf.app.run()
  File "/usr/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "Convolution_Neural_Network.py", line 129, in main
    model_fn=cnn_model_fn, model_dir="/mnist_convnet_model/")
  File "/usr/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 171, in __init__
    _verify_model_fn_args(model_fn, params)
  File "/usr/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 742, in _verify_model_fn_args
    raise ValueError('model_fn (%s) must include features argument.' % model_fn)
ValueError: model_fn (<function cnn_model_fn at 0x53790c8>) must include features argument.

错误来自这一行:

model_fn=cnn_model_fn, model_dir="/mnist_convnet_model/")

如果你能帮助我,我将非常感激。

1 个答案:

答案 0 :(得分:0)

你可能在函数cnn_model_fn的定义中重命名了名为'features'的变量。我有类似的问题,因为我将其重命名为'输入'。