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

yipeiwu_com6年前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设计】。

相关文章

Python基于datetime或time模块分别获取当前时间戳的方法实例

python的时间模块生成时间戳的方法是非常简单的,因为最近频繁用到了时间戳功能,这里简单总结了一下日常使用最为频繁的两个时间模块各自生成当前时间戳的方法,很简单,具体如下: now...

python3中的md5加密实例

在python3的标准库中,已经移除了md5,而关于hash加密算法都放在hashlib这个标准库中,如SHA1、SHA224、SHA256、SHA384、SHA512和MD5算法等。...

用Python实现校园通知更新提醒功能

用Python实现校园通知更新提醒功能

前言 这个项目实已经在一个月前已经完成了,一直都想写一篇博客来总结这个过程中遇到的一些问题。但最近一个月来都比较忙,所以一直拖到了现在。 首先说说起因吧,我没事的时候,总喜欢依次点开学校...

Python编程中归并排序算法的实现步骤详解

基本思想:归并排序是一种典型的分治思想,把一个无序列表一分为二,对每个子序列再一分为二,继续下去,直到无法再进行划分为止。然后,就开始合并的过程,对每个子序列和另外一个子序列的元素进行比...

Python字符串大小写转换拼接删除空白

1.字符串大小写转换 string.title() #将字符串中所有单词的首字母以大写形式显示 string.upper() #将字符串中所有字母转化为大写字母 stri...