0

I was trying to predict handwritten digits with tensorflow and mnist datasets. But I get error. How can I solve the error?

import tensorflow as tf
.
.    #code
.    #code
.    #code
.
y_pred= tf.nn.softmax(layer3)  # USING SOFTMAX

init_op= tf.initialize_all_variables()
saver= tf.train.Saver()

# RESTORING MODEL
with tf.Session() as sess:
    sess.restore(sess, 'model.ckpt')
    sess.run(init_op)

    prediction= tf.argmax(y_pred, 1)
    print(prediction.eval(feed_dict={x: [imvalue],keep_prob: 1.0}
                       ,session=sess))

The code throws the below error:

Traceback (most recent call last):
  File "/home/monojit/writtenRecognition/digi.py", line 127, in <module>
sess.restore(sess, 'model.ckpt')
AttributeError: 'Session' object has no attribute 'restore'
Monojit Sarkar
  • 657
  • 1
  • 5
  • 15
  • change to `saver.restore` more info can be found here https://www.tensorflow.org/programmers_guide/saved_model – shahaf Apr 28 '18 at 08:18
  • 3
    Possible duplicate of [Tensorflow: how to save/restore a model?](https://stackoverflow.com/questions/33759623/tensorflow-how-to-save-restore-a-model) – kabanus Apr 28 '18 at 08:18

0 Answers0