如何将无output节点的TensorFlow模型保存为pb文件?
- 内容介绍
- 文章标签
- 相关推荐
本文共计1151个文字,预计阅读时间需要5分钟。
在Tensorflow中保存为pb文件,需要使用函数`graph_util.convert_variables_to_constants`。该函数的调用格式为:`graph_util.convert_variables_to_constants(sess, sess.graph_def, output_node_names=[需要保存的节点名称])`。其中,`output_node_names`列表中需要填写你想要保存的节点名称。如果这些节点在神经网络中没有显式定义,则无法保存。
Tensorflow中保存成pb file 需要 使用函数
graph_util.convert_variables_to_constants(sess, sess.graph_def,
output_node_names=[]) []中需要填写你需要保存的结点。如果保存的结点在神经网络中没有被显示定义该怎么办?
例如我使用了tf.contrib.slim或者keras,在tf的高层很多情况下都会这样。
本文共计1151个文字,预计阅读时间需要5分钟。
在Tensorflow中保存为pb文件,需要使用函数`graph_util.convert_variables_to_constants`。该函数的调用格式为:`graph_util.convert_variables_to_constants(sess, sess.graph_def, output_node_names=[需要保存的节点名称])`。其中,`output_node_names`列表中需要填写你想要保存的节点名称。如果这些节点在神经网络中没有显式定义,则无法保存。
Tensorflow中保存成pb file 需要 使用函数
graph_util.convert_variables_to_constants(sess, sess.graph_def,
output_node_names=[]) []中需要填写你需要保存的结点。如果保存的结点在神经网络中没有被显示定义该怎么办?
例如我使用了tf.contrib.slim或者keras,在tf的高层很多情况下都会这样。

