训练报错 train_accuracy = accuracy.eval(feed_dict={x: batch[0], y: batch[1], keep_prob: 1.0}) 不知道哪里出错了

来源:3-7 TensorFlow结合mnist进行卷积模型训练(4)

精慕门3471333

2018-11-09 02:16

Traceback (most recent call last):

  File "D:/user/pycharm/mnist_test/mnist/convolutional.py", line 27, in <module>

    train_accuracy = accuracy.eval(feed_dict={x: batch[0], y: batch[1], keep_prob: 1.0})

  File "D:\program files\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 680, in eval

    return _eval_using_default_session(self, feed_dict, self.graph, session)

  File "D:\program files\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 4937, in _eval_using_default_session

    raise ValueError("Cannot evaluate tensor using `eval()`: No default "

ValueError: Cannot evaluate tensor using `eval()`: No default session is registered. Use `with sess.as_default()` or pass an explicit session to `eval(session=sess)`


Process finished with exit code 1


写回答 关注

1回答

  • niaiai
    2018-12-01 13:21:56
    train_accuracy = accuracy.eval(feed_dict={x: batch[0], y_: batch[1], keep_prob: 1.0})


TensorFlow与Flask结合打造手写体数字识别

TensorFlow和flask结合识别自己的手写体数字

20432 学习 · 102 问题

查看课程

相似问题