【发布时间】:2017-07-10 22:00:16
【问题描述】:
我正在使用 tensorflow 0.12 并且在转换时遇到问题。 下面的 sn-p 代码做了一件奇怪的事情:
sess = tf.InteractiveSession()
a = tf.constant(1)
b = tf.cast(a, tf.float32)
print b.eval()
我得到一个值: 6.86574233e-36
我也尝试过使用tf.to_float() 和tf.saturate_cast。两者都给出了相同的结果。
请帮忙。
【问题讨论】:
-
我无法在 TF 1.0 中重现您的问题。
-
您是否在 GPU 上运行 Tensorflow,如果是,您使用什么 GPU 卡? Tensorflow 是用哪个 cuda 版本编译的?有时,当使用 cuda 版本不支持的 gpu 时,会发生奇怪的事情而没有任何错误消息。
-
嗨,我在 CPU 上运行:Intel Xeon E5-2680
-
我面临同样的问题。在其他机器上运行良好的代码在我的机器上会出现这种奇怪的行为。你解决了吗?如何?谢谢!
-
@ana 不,还没有解决。我发现虽然使用 tf.saturate_cast 不会导致问题
标签: python python-2.7 tensorflow