美文网首页
tensorflow打印tensor的值

tensorflow打印tensor的值

作者: 萌萌Msy | 来源:发表于2018-08-21 11:32 被阅读0次

调试程序时候,有时候需要打印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]]

相关文章

网友评论

      本文标题:tensorflow打印tensor的值

      本文链接:https://www.haomeiwen.com/subject/fcvdiftx.html