tensorflow打印tensor的值

2018-08-21  本文已影响0人  萌萌Msy

调试程序时候,有时候需要打印tensor的值的时候,直接print显示的是如下tensor的shape、dtype等信息

    Tensor("random_uniform:0", shape=(3, 2), dtype=float32)

使用如下方法可打印tensor值

    sess = tf.InteractiveSession()  
    print(tensor.eval())

结果:

[[-0.65921688  0.87367666]
 [-0.75594002 -0.52820003]
 [-0.22761697 -0.32550669]]
上一篇 下一篇

猜你喜欢

热点阅读