我通过 conda install tensorflow-gpu
安装了 tensorflow-gpu
。
但是,我安装的电脑没有GPU。我这样做是因为我正在将 conda env 移植到离线计算机。
当我将 tensorflow 导入为 tf
并调用 tf.test.is_built_with_cuda()
时,结果为 False
。尽管计算机没有 GPU,但我希望结果为 True
,因为我安装了
带领 tensorflow -GPU。
在这种情况下,tf.test.is_built_with_cuda() 的输出应该是什么?
为什么我得到 False
?
最佳答案
我刚刚使用之前运行 CUDA GPU 的服务器对此进行了测试,但后来移除了 GPU - 与您的情况非常相似。我安装了 tensorflow-gpu==2.5.0
。
>>> import tensorflow as tf
2021-07-28 18:42:44.236258: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0
>>> tf.test.is_built_with_cuda()
True
记录了一个类似的问题 here .因此,您很可能缺少 CUDA/CUDNN。
关于python - tf.test.is_built_with_cuda() 应该输出什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68568748/