tensorflow saves the trained deep learning model

Recently, I was looking at the algorithm of MKR. After the reproduction runs through, save the trained model.

Just add the following code

saver = tf.train.Saver()
saver.save(sess, '../model/MKRmodel.ckpt')
print('模型已保存')

The above code should be indented with sess.run(), otherwise an error will be reported.

The intermediate code is too long, the first time I wrote to the indented place in front of sess.run(), an error message told me that sess has been closed. . .

Guess you like

Origin blog.csdn.net/dlz_yhn/article/details/129428759