我们正在尝试使用TensorFlow示例中的文本分类示例(tensorflow/examples/learn/text_classification.py)。它适用于db_pedia数据。从tensorflow tensorflow保存示例文本分类模型/ examples/learn/text_classification.py
现在我们试图使用Saver保存/恢复模型,但我们没有获取使用Saver API的位置,因为text_classification.py中的代码根本不使用Session,并且Saver API需要会话来保存/恢复。
我们训练有素的使用model_dir模型,并尝试使用相同model_dir预测。模型保存但试图预测时(训练代码评论),出现错误: InvalidArgumentError(请参阅上面的追溯):分配要求两个张量的形状匹配。 lhs shape = [10,50] rhs shape = [5386,50] [[Node:save/Assign = Assign [T = DT_FLOAT,_class = [“loc:@ EmbedSequence/embeddings”],use_locking = true,validate_shape = true,_device =“/ job:localhost/replica:0/task:0/cpu:0”](EmbedSequence/embeddings,save/RestoreV2)]] –
已在此提交bug:https://github.com/tensorflow/ tensorflow /问题/ 13971 –