import tensorflow as tf
sess=tf.Session
with tf.Graph().as_default():
with tf.gfile.FastGFile(‘*.pb’,’rb’) as modelfile:
graph_def=tf.GraphDef()
graph_def.ParseFromString(modelfile.read())
tf.import_graph_def(graph_def)
[print(n.name) for n in tf.get_default_graph().as_graph_def().node]
博客内容展示了使用TensorFlow加载模型的代码。通过导入TensorFlow库,创建会话,读取.pb模型文件,解析图定义并导入,最后打印默认图中所有节点的名称,体现了TensorFlow在模型处理方面的应用。
607

被折叠的 条评论
为什么被折叠?



