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实现CNN的多通道输入实例

CNN可以同时进行多通道的输入,例如一张彩色图片可以分解成RGB三个通道输入给CNN,当使用自己的数据集时,可以通过numpy来实现数据的多通道输入。 假设我们有两个组数据a和b:...

Python实现二维曲线拟合的方法

如下所示: from numpy import * import numpy as np import matplotlib.pyplot as plt plt.close() f...

python使用xmlrpc实例讲解

RPC是Remote Procedure Call的缩写,翻译成中文就是远程方法调用,是一种在本地的机器上调用远端机器上的一个过程(方法)的技术,这个过程也被大家称为“分布式计算”,是为...

django解决跨域请求的问题

解决方案 1.安装django-cors-headers pip install django-cors-headers 2.配置settings.py文件 INSTA...

python实现录音小程序

本文为大家分享了python实现录音小程序的具体代码,供大家参考,具体内容如下 学习目标:掌握python的pyaudio扩展包和Wave模块录制语音的方法 Wav音频:声道数,采...