美文网首页
tensorflow踩坑

tensorflow踩坑

作者: _Megamind_ | 来源:发表于2019-03-20 09:55 被阅读0次
  • 安装
  1. pip install tensorflow
  2. 先安装 anaconda,然后 conda install tensorflow
    [ps: 推荐使用方法2,可以有效处理在不同服务器上动态链接库版本问题]
  • tf.Print() 的使用

由于 tensorflow 的所有计算都是在图构建完之后进行feed,因此没有办法在设计图的时候设置断点或者 print 出结果,这样不方便 debug。使用 tf.Print() 就可以解决这个问题:
target_tensor_print = tf.Print(target_tensor, [target_tensor], "提示信息")

tf.Print
这样就可以看到流经 target_tensor 的数据了。
或者可以查看 target_tensor 的形状:
tf.Print(target_tensor, [tf.shape(target_tensor)], "提示信息")

相关文章

网友评论

      本文标题:tensorflow踩坑

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