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

yipeiwu_com5年前Python基础

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')

以上这篇TensorFlow查看输入节点和输出节点名称方式就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

Django实战之用户认证(用户登录与注销)

Django实战之用户认证(用户登录与注销)

上一篇中,我们已经打开了Django自带的用户认证模块,并配置了数据库连接,创建了相应的表,本篇我们将在Django自带的用户认证的基础上,实现自己个性化的用户登录和注销模块。 首先,我...

python2.7安装图文教程

python2.7安装图文教程

Python安装过程,供大家参考,具体内容如下 1.下载安装程序 我们安装Python的一个重要目的是为了用IAR编译CC2640 OAD文件时执行合并文件的脚本,所以我们一起来看看Py...

解决pycharm上的jupyter notebook端口被占用问题

解决pycharm上的jupyter notebook端口被占用问题

在pycharm中的jupyter notebook上经常会出现端口被占用,ipython的port端口一般是8888 如果打开了jupyter notebook,而没有关闭时,再次打开...

python 文件操作删除某行的实例

使用continue跳过本次写循环就可以了 #文本内容 Yesterday when I was young 昨日当我年少轻狂 The tasting of life was swe...

Python max内置函数详细介绍

Python max内置函数 max(iterable, *[, key, default]) max(arg1, arg2, *args[, key]) Return the larg...