tensorflow 实现打印pb模型的所有节点

发布时间:2020-09-26 16:58:08 作者:coocoky
来源:脚本之家 阅读:352

只有pd模型文件, 打印所有节点

from tensorflow.python.framework import tensor_util
from google.protobuf import text_format
import tensorflow as tf
from tensorflow.python.platform import gfile
from tensorflow.python.framework import tensor_util


GRAPH_PB_PATH = 'models/frozen_person_graph.pb' #path to your .pb file
with tf.Session() as sess:
	print("load graph")
	with gfile.FastGFile(GRAPH_PB_PATH,'rb') as f:
		graph_def = tf.GraphDef()
  # Note: one of the following two lines work if required libraries are available
		#text_format.Merge(f.read(), graph_def)
		graph_def.ParseFromString(f.read())
		tf.import_graph_def(graph_def, name='')
		for i,n in enumerate(graph_def.node):
			print("Name of the node - %s" % n.name)

以上这篇tensorflow 实现打印pb模型的所有节点就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持亿速云。

推荐阅读:
  1. 如何实现TensorFlow固化模型
  2. tensorflow如何使用freeze_graph.py将ckpt转为pb文件

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

tensorflow 打印 pb模型

上一篇:tomcat7w.exe 出现指定的服务未安装的解决方法

下一篇:Android 实现仿支付宝的密码均分输入框

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》