Python 如何打印tensorflow中的张量数
在中,我要打印标签和登录 我试过一些方法,但都不管用。Python 如何打印tensorflow中的张量数,python,tensorflow,computer-vision,Python,Tensorflow,Computer Vision,在中,我要打印标签和登录 我试过一些方法,但都不管用。 我怎样才能得到这些张量的数目 with tf.Graph().as_default(): # Get images and labels from the dataset. # with tf.Session() as sess: # images, labels = image_processing.inputs(dataset) # print ("lable") # sess.run (labels.eval())
我怎样才能得到这些张量的数目
with tf.Graph().as_default():
# Get images and labels from the dataset.
# with tf.Session() as sess:
# images, labels = image_processing.inputs(dataset)
# print ("lable")
# sess.run (labels.eval())
images, labels = image_processing.inputs(dataset)
# sess = tf.Session()
# print("lable")
# print (labels)
# Number of classes in the Dataset label set plus 1.
# Label 0 is reserved for an (unused) background class.
num_classes = dataset.num_classes() + 1
# Build a Graph that computes the logits predictions from the
# inference model.
logits, _ = inception.inference(images, num_classes)
print ("logits")
# print (tf.cast(logits,tf.float32).eval())
# print ("_")
# print (tf.cast(_,tf.float32).eval())
如果检查inception_模型文件,您将看到返回两个张量: 罗吉斯。二维浮动张量 辅助后勤。二维浮点数张量 侧头。仅用于培训 所以你只需要创建一个会话并在会话中运行这个张量。这个问题我已经解决了。这就是解决办法。