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实现树形打印目录结构

本文实例为大家分享了python树形打印目录结构的具体代码,供大家参考,具体内容如下 前言 这两天整理数据文件的时候发现,一层层的点击文件夹查看很繁琐,于是想写一个工具来递归打印出文件目...

对python读写文件去重、RE、set的使用详解

如下所示: # -*- coding:utf-8 -*- from datetime import datetime import re def Main(): sou...

wxPython中文教程入门实例

wxPython中文教程入门实例 wx.Window 是一个基类,许多构件从它继承。包括 wx.Frame 构件。可以在所有的子类中使用 wx.Window 的方法。 wxPython的...

python实现祝福弹窗效果

python实现祝福弹窗效果

中秋节,是中国传统节日之一,为每年的农历八月十五,也是我国仅次于春节的第二大传统节日。传说是为了纪念嫦娥。 祝大家中秋快乐 中秋节,怎么用python祝福大家节日快乐是一个很头疼的事,但...

Python3连接MySQL(pymysql)模拟转账实现代码

本文实例为大家分享了Python3连接MySQL模拟转账的具体实现代码,供大家参考,具体内容如下 # coding:utf8 import sys import pymysql...