在tensorflow中恢复检查点时出错

时间:2016-06-10 15:15:50

标签: tensorflow

我使用此代码来保存张量流模型:

saver = tf.train.Saver()
saver.save(session, 'model.ckpt')

现在,当我想使用此代码恢复模型时:

with tf.Session() as session:
    ckpt = tf.train.get_checkpoint_state(checkpoint_dir='/Documents/')
    if ckpt and ckpt.model_checkpoint_path:
        saver.restore(session, ckpt.model_checkpoint_path)
    else:
        print("no checkpoint found")

我收到此错误:

ValueError: Fetch argument u'save/restore_all' of u'save/restore_all' cannot be interpreted as a Tensor. ("The name 'save/restore_all' refers to an Operation not in the graph.")

如何解决此问题并恢复会话?

0 个答案:

没有答案