输出tensorflow版本代码,tensorflow打印变量
一测试代码:
$ cat export_nodename.py#!/usr/bin/env python from _ _ future _ _ import absolute _ import from _ _ future _ _ import division from _ _ future _ _ import print _ function #编码:utf-8导入张量流为tf导入osmodel _ dir= work/CNN/CNN 2/training model _ name= dnn。Pb #读取并创建一个图图表来存放谷歌训练好的模型(函数)def create_graph()。用TF。gfile。gfile(OS。路径。join(型号目录,型号名称), rb )作为女:#使用tf .GraphDef()定义一个空的Graph graph_def=tf .GraphDef() graph_def .ParseFromString(f.read()) #将图形从图形_定义导入到当前默认图形中. tf.import_graph_def(graph_def,name=)#创建graph create _ graph()tensor _ name _ list=[张量。TF中张量的名称。get _ default _ graph()。as_graph_def().张量名称列表中张量名称的node]print(张量名称)~ 2运行代码查看结果
$ python导出节点名。py wav _ data decoded _ sample _ dataaudioscoprogramfccreshape/shape shape _ 1/shape shape _ 1 variable variable/read con v2 addrelureshape _ 2/shape shape _ 2 variable _ 2/read variable _ 3 variable _ 3/readMatMuladd _ 1 variable _ 4 variable _ 4/read variable _ 5 variable _ 5/readMatMul _ 1 add _ 2 variable _ 6 variable _ 6/read variable _ 7 variable _ 7