0
我試圖在三維結束時保存模型,並在每次訓練開始時恢復模型。我只是跟着this link做了什麼。TensorFlow:恢復模型
saver = tf.train.Saver()
with tf.Session(graph=graph) as session:
# Initializate the weights and biases
tf.global_variables_initializer().run()
new_saver = tf.train.import_meta_graph('model.meta')
new_saver.restore(sess,tf.train.latest_checkpoint('./'))
W1 = session.run(W)
print(W1)
for curr_epoch in range(num_epochs):
train_cost = train_ler = 0
start = time.time()
for batch in range(num_batches_per_epoch):
...Some training...
W2 = session.run(W)
print(W2)
save_path = saver.save(session, "models/model")
但它給下面的錯誤:
---> new_saver.restore(session, tf.train.latest_checkpoint('./'))
SystemError: <built-in function TF_Run> returned a result with an error set
誰能幫助我嗎?非常感謝!
要保存到「模式/模式」尚未從加載「./」 ,你有沒有嘗試修復路徑? – lejlot
是的,起初我運行代碼而不恢復,然後我運行上面的代碼。 –