例如模型保存在checkpoint文件夾下,保存的文件名分別爲:
model.index,
model.data,
model.meta
with tf.Session(config=config) as sess:
saver = tf.train.import_meta_graph('./checkpoint/model.meta'))
save_path = './checkpoint/model'
saver.restore(sess = sess, save_path = save_path)
需要注意的是saver.restore中的save_path路徑在./checkpoint文件夾路徑之後要寫到模型的名字,不包含模型的後綴。
不然會提示錯誤:NotFoundError (see above for traceback): Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ...