tensorflow從.meta,.data,.index格式的模型文件中restore模型

例如模型保存在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 ...

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章