python - tf.train.Saver().restore() 和 tf.saved_model.loader 之间有什么区别

标签 python tensorflow

我想知道 tf.train.Saver().restore()tf.saved_model.loader()

据我所知,tf.train.Saver().restore()checkpoint 文件中恢复之前保存的变量;并且 tf.saved_model.loader()pb 文件加载图形 def。

但我不知道什么时候应该选择 restore()loader()

最佳答案

在训练、从检查点恢复等过程中,您想使用保护程序。如果您正在加载导出的模型进行推理,您只想使用保存的模型。

关于python - tf.train.Saver().restore() 和 tf.saved_model.loader 之间有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45075568/

相关文章:

Python正则表达式删除所有包含数字的单词

python - 如何在 Python 的正则表达式中使用带括号的 * 或 +?

python - 从 [tensorflow 1.00] 中的 softmax 层提取概率

python - Tensorflow:修改隐藏状态的计算

python - Python 中 'none' 类型的单元测试

python - 将列表元素与 numpy 数组中的列进行比较

python - 您可以使用雅虎财经 API 使用 pandas 提取当前或过去的股息数据吗?

python - BERT 和 ALBERT 的训练数据损失大且准确率低

python - 机器学习奇数/偶数预测不起作用(50% 成功)

python - 从 TensorFlow 中高效地获取梯度?