2017-10-12 109 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 –