Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何打印tensorflow中的张量数_Python_Tensorflow_Computer Vision - Fatal编程技术网

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_模型文件,您将看到返回两个张量:

罗吉斯。二维浮动张量

辅助后勤。二维浮点数张量 侧头。仅用于培训

所以你只需要创建一个会话并在会话中运行这个张量。

这个问题我已经解决了。这就是解决办法。