怎么print或者查看tf.tensor中的数值

  统计/机器学习 Python TensorFlow    浏览次数:8604        分享
0

怎么print或者查看tf.tensor中的数值?

如果直接用print,并不能得到tensor里元素的数值

>> a = tf.random_normal([2, 3])
>> print(a)
Tensor("random_normal_9:0", shape=(2, 3), dtype=float32)

有什么方法可以print或者直接查看tf.Tensor中的数值的吗?


 

wlk1993   2017-12-25 15:55



   1个回答 
0

要在with tf.Session()里才能查看tensor里的数值

a = tf.random_normal([2, 3])
with tf.Session():
    print(a.eval())


SofaSofa数据科学社区DS面试题库 DS面经

数据痴汉   2017-12-26 12:36



  相关讨论

python里print时出现ValueError: unsupported format character 错误

print里的"%.2f"是什么意思?

print(__doc__)有什么用?

print的时候报错:TypeError: unsupported operand type(s) for /: 'str' and 'int'

tf.placeholder和tf.variable什么区别?

tf.add和直接使用加号+有什么区别吗?

pycharm+anaconda的安装问题

tf.truncated_normal和tf.random_normal有什么区别?

模仿tensorflow教程10-11的代码,报错,求解

tf.reduce_sum是什么函数

  随便看看

去掉pandas DataFrame的index的名字

sklearn里的LabelEncoder什么用?

训练神经网络中经常提到的epoch是什么意思

如何度量一个分布长尾的程度?

怎么添加pandas的dataframe到已有的csv文件,并且不覆盖原内容