2017-10-12 125 views

回答

0

該示例使用tf.estimator.Estimator,其具有用於保存的特殊方法 export_savedmodel

此外,您可以指定model_dirconstructor

Directory to save model parameters, graph and etc. This can also be used to load checkpoints from the directory into a estimator to continue training a previously saved model. If None, the model_dir in config will be used if set. If both are set, they must be same. If both are None, a temporary directory will be used.

+0

我們訓練有素的使用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)]] –

+0

已在此提交bug:https://github.com/tensorflow/ tensorflow /問題/ 13971 –