网络编程
位置:首页>> 网络编程>> Python编程>> TensorFlow查看输入节点和输出节点名称方式

TensorFlow查看输入节点和输出节点名称方式

作者:醉雨轩Y  发布时间:2022-11-27 04:50:11 

标签:TensorFlow,输入,节点,输出

TensorFlow 定义输入节点名称input_name:


with tf.name_scope('input'):
 bottleneck_input = tf.placeholder_with_default(
   bottleneck_tensor,
   shape=[batch_size, bottleneck_tensor_size],
   name='Mul')

TensorFlow查看pb数据库里面的输入节点和输出节点:


import tensorflow as tf
import os

model_dir = './tmp/'
model_name = 'output_graph.pb'

def create_graph():
 with tf.gfile.FastGFile(os.path.join(
     model_dir, model_name), 'rb') as f:
   graph_def = tf.GraphDef()
   graph_def.ParseFromString(f.read())
   tf.import_graph_def(graph_def, name='')

create_graph()
tensor_name_list = [tensor.name for tensor in tf.get_default_graph().as_graph_def().node]
for tensor_name in tensor_name_list:
 print(tensor_name,'\n')

来源:https://blog.csdn.net/miao0967020148/article/details/89434253

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com