代码语言:javascript复制
import tensorflow as tf
from tensorflow.python.platform import gfile
pb_file = ‘xxx/xxx/xxx.pb’
pb_log_dir = ‘xxx/xxx/log/’
def show_pb_graph():
graph = tf.get_default_graph()
graph_def = graph.as_graph_def()
graph_def.ParseFromString(gfile.FastGFile(pb_file, 'rb').read())
tf.import_graph_def(graph_def, name='graph')
writer = tf.summary.FileWriter(pb_log_dir, graph)
writer.close()
print('n logs has been saved at {} n'.format(pb_log_dir))
if __name__ == '__main__':
show_pb_graph()