我有一个使用Tensorflow的简单神经网络。 会议内容如下:
with tensorFlow.Session() as sess:
sess.run(tensorFlow.global_variables_initializer())
for epoch in range(epochs):
i = 0
epochLoss = 0
for _ in range(int(len(data) / batchSize)):
ex, ey = nextBatch(i)
i += 1
feedDict = {x :ex, y:ey }
_, cos = sess.run([optimizer,cost], feed_dict= feedDict)
epochLoss += cos / (int(len(data)) / batchSize)
print("Epoch", epoch + 1, "completed out of", epochs, "loss:", "{:.9f}".format(epochLoss))
save_path = saver.save(sess, "model.ckpt")
print("Model saved in file: %s" % save_path)
在最后2行,我保存了模型并在另一个类中恢复了图形:
^{pr2}$我想重新训练模型,这意味着不初始化权重,只是从它停止的最后一个点更新它们。在
我怎么能做到呢?在
来自https://www.tensorflow.org/api_docs/python/state_ops/saving_and_restoring_variables
以下示例来自https://www.tensorflow.org/how_tos/variables/
相关问题 更多 >
编程相关推荐