我想通過將圖形保存到文件然後運行graph_metrics.py來查看我的模型的統計信息。使用graph_metrics.py和保存的圖形
我已經嘗試了一些不同的東西寫的文件,我最大的努力爲:
tf.train.write_graph(session.graph_def, ".", "my_graph", as_text=True)
但在這裏會發生什麼:
$ python ./util/graph_metrics.py --noinput_binary --graph my_graph
Traceback (most recent call last):
File "./util/graph_metrics.py", line 137, in <module>
tf.app.run()
File ".virtualenv/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 30, in run
sys.exit(main(sys.argv))
File "./util/graph_metrics.py", line 85, in main
FLAGS.batch_size)
File "./util/graph_metrics.py", line 109, in calculate_graph_metrics
input_tensor = sess.graph.get_tensor_by_name(input_layer)
File ".virtualenv/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2531, in get_tensor_by_name
return self.as_graph_element(name, allow_tensor=True, allow_operation=False)
File ".virtualenv/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2385, in as_graph_element
return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
File ".virtualenv/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2427, in _as_graph_element_locked
"graph." % (repr(name), repr(op_name)))
KeyError: "The name 'Mul:0' refers to a Tensor which does not exist. The operation, 'Mul', does not exist in the graph."
是否有保存圖形的一個完整的工作示例,然後用graph_metrics.py
進行分析?
這個過程似乎涉及我還沒有發現的魔法咒語。
相關問題我在哪裏得到了我的基本保存方法:http://stackoverflow.com/q/36682832/86967 – nobar