在Tensor Flow中保存和恢复经过培训的LSTM [英] Saving and Restoring a trained LSTM in Tensor Flow

查看:79
本文介绍了在Tensor Flow中保存和恢复经过培训的LSTM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用BasicLSTMCell训练了LSTM分类器.如何保存我的模型并将其还原以供以后的分类使用?

I trained a LSTM classifier, using a BasicLSTMCell. How can I save my model and restore it for use in later classifications?

推荐答案

我自己在想这个问题.正如其他指出的那样,在TensorFlow中保存模型的通常方法是使用tf.train.Saver(),但是我相信这可以保存tf.Variables的值. 我不确定在执行此操作时是否自动保存了BasicLSTMCell实现中是否存在tf.Variables,或者是否还需要执行其他步骤,但是如果所有其他步骤均失败,则BasicLSTMCell可以轻松保存并加载到pickle文件中.

I was wondering this myself. As other pointed out, the usual way to save a model in TensorFlow is to use tf.train.Saver(), however I believe this saves the values of tf.Variables. I'm not exactly sure if there are tf.Variables inside the BasicLSTMCell implementation which are saved automatically when you do this, or if there is perhaps another step that need to be taken, but if all else fails, the BasicLSTMCell can be easily saved and loaded in a pickle file.

这篇关于在Tensor Flow中保存和恢复经过培训的LSTM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆