【问题标题】:How to print tensor list?如何打印张量列表?
【发布时间】:2017-12-26 21:40:25
【问题描述】:

不知道有没有办法以张量列表的数据类型打印输入队列。

import tensorflow as tf

image=tf.cast(image,tf.string)#list of input image directory
label=tf.cast(label,tf.int32) #list of input image label

input_queue=tf.train.slice_input_producer([image,label])

with tf.Session() as session:
     print(session.run(input_queue))

如果print input_queue这样,程序继续运行,不会有任何响应。

【问题讨论】:

  • 您能否为张量 imagelabel 添加一些示例条目?这样我就可以研究解决方案。只需几个条目就可以了。
  • 另外,看到这个答案会有所帮助:stackoverflow.com/questions/43567552/…
  • 你可以参考这个 [script](github.com/kevin28520/My-TensorFlow-tutorials/blob/master/…) 我刚刚从第 97 行引用。谢谢 :) @kmario23
  • 如果您在使用tf.read_file() 阅读后尝试打印它,那么我猜它会起作用。因为这些图像必须从您的目录中读取。

标签: python tensorflow neural-network deep-learning conv-neural-network


【解决方案1】:

您可以使用 eval() 函数来获取张量。对于您的代码,您可以使用print(input_queue.eval()) 打印“input_queue”。

【讨论】:

    猜你喜欢
    • 2021-12-16
    • 2023-01-11
    • 2017-09-12
    • 2018-06-26
    • 2019-09-30
    • 1970-01-01
    • 1970-01-01
    • 2017-01-14
    相关资源
    最近更新 更多