我們正在嘗試使用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 –