张量流图已加载,在加载期间,我想检查每个节点输出处的张量的形状。
我可以打印出姓名。但是无法打印出形状。 我要做的是
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'}
import tensorflow as tf
import cv2
import numpy as np
import time
with tf.Session() as sess:
#load graph
with tf.gfile.FastGFile("recognition_tf_model/frozen_model.pb",'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
sess.graph.as_default()
graph_nodes=[n for n in graph_def.node]
names = []
for t in graph_nodes:
print(t.name)
除了名称之外,我还喜欢打印每个输出的形状。 我该怎么办?