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

相关文章

easy_install python包安装管理工具介绍

easy_install更准确的说是一个和setuptools绑定的模块,一切下载、构建、安装和管理的工作都可以由它来担当。 一般的执行方式: easy_install + URL 但是...

numpy中索引和切片详解

numpy中索引和切片详解

索引和切片 一维数组 一维数组很简单,基本和列表一致。 它们的区别在于数组切片是原始数组视图(这就意味着,如果做任何修改,原始都会跟着更改)。 这也意味着,如果不想更改原始数组,我们需要...

详解python分布式进程

在Thread和Process中,应当优选Process,因为Process更稳定,而且,Process可以分布到多台机器上,而Thread最多只能分布到同一台机器的多个CPU上。 Py...

春节到了 教你使用python来抢票回家

这篇文章主要介绍了春节到了 教你使用python来抢票回家,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 不知不觉,一年一度的春运抢票...

django+js+ajax实现刷新页面的方法

本文实例讲述了django+js+ajax实现刷新页面的方法。分享给大家供大家参考,具体如下: 在服务器开发的时候,为了方便将服务器对外开一个接口来操作,可以使用django制作网页,通...