Skip to content

Instantly share code, notes, and snippets.

@Roger8
Created January 11, 2019 09:18
Show Gist options
  • Save Roger8/a1e8b53219b832bdcc9044ddfef4cb0f to your computer and use it in GitHub Desktop.
Save Roger8/a1e8b53219b832bdcc9044ddfef4cb0f to your computer and use it in GitHub Desktop.
查看tensorflow pb模型文件的节点信息:

import tensorflow as tf with tf.Session() as sess: with open('./quantized_model.pb', 'rb') as f: graph_def = tf.GraphDef() graph_def.ParseFromString(f.read()) print graph_def output = tf.import_graph_def(graph_def, return_elements=['out:0']) print(sess.run(output))

复制代码 效果:

复制代码

...

node { name: "FullyConnected/BiasAdd" op: "BiasAdd" input: "FullyConnected/MatMul" input: "FullyConnected/b/read" attr { key: "T" value { type: DT_FLOAT } } attr { key: "data_format" value { s: "NHWC" } } } node { name: "FullyConnected/Softmax" op: "Softmax" input: "FullyConnected/BiasAdd" attr { key: "T" value { type: DT_FLOAT } } } library { }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment