0
点赞
收藏
分享

微信扫一扫

tensorflow 将ckpt保存为pb文件


from tensorflow.python.framework.graph_util import convert_variables_to_constants

saver = tf.train.Saver(tf.trainable_variables())
saver.restore(sess, "model.ckpt-100000")
graph = convert_variables_to_constants(sess,
sess.graph_def,
output_node_names=["predicts", "scores", "logits"])
with tf.gfile.FastGFile("the_model.pb", mode="wb") as f:
f.write(graph.SerializeToString())

TensorFlow版本:1.14 or 1.15


举报

相关推荐

0 条评论