在tensorflow 0.12版本中存在saver.restore的问题。当我将会话保存到当前目录时,它被设法保存。但是,当我试图恢复会话时,它不适用于相同的路径。当我尝试使用绝对路径时,它正在工作。
有人可以帮我解决这个问题吗?
import tensorflow as tf
constant = tf.Variable("This is constant")
saver = tf.train.Saver()
init = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
saver.restore(sess, 'sample_code')
for i in range(4):
print(sess.run(constant))
saver.save(sess, 'sample_code')
输出:
NotFoundError (see above for traceback): Unsuccessful TensorSliceReader constructor: Failed to find any matching files for sample_code