将Tensorflow会话保存为SavedModel格式

问题描述

我已经构建了一个张量流图,并且能够通过以下方式加载该图。

import tensorflow as tf
GRAPH_PB_PATH = path
with tf.Session() as sess:
    print("load graph")
    with tf.gfile.GFile(GRAPH_PB_PATH,'rb') as f:
        graph_def = tf.GraphDef()
    graph_def.ParseFromString(f.read())
    sess.graph.as_default()
    tf.import_graph_def(graph_def,name='')
    graph_nodes=[n for n in graph_def.node]
    names = []
    for t in graph_nodes:
        names.append(t.name)
    print(names)

我想在Google AI平台上提供模型。如何从Google期望的Tensorflow中以sess格式保存SavedModel

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)