tensorflow - AttributeError : module 'tensorflow_core._api.v2.config' has no attribute 'list_physical_devices'

标签 tensorflow tensorflow2.0

我在Ubuntu 18.04上使用Tensorflow 2.0。运行时

tf.config.list_physical_devices('GPU')

我收到上述错误。解决方法是什么?

最佳答案

运行tf.config.experimental.list_physical_devices('GPU')查看所有GPU

或者

运行tf.config.experimental.list_physical_devices(device_type=None)查看所有设备

您也可以使用tf.test.is_gpu_available()。如果检测到可用的GPU,则说True。

关于tensorflow - AttributeError : module 'tensorflow_core._api.v2.config' has no attribute 'list_physical_devices' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59266150/

相关文章:

tensorflow - 如何循环 TensorFlow 中的可变长度占位符?

tensorflow - 用非标量的值填充张量

javascript - TENSORFLOW.JS 3D 姿势估计不起作用

python - Tensorflow - 训练期间的 Nan 成本值 - 尝试了通常的修复但没有成功

python - 拟合 Keras 模型会产生错误 "constant folding failed: Invalid argument: Unsupported type: 21"

python - TensorFlow 2.0 : Eager execution of training either returns bad results or doesn't learn at all

Tensorflow:尝试恢复 pb 文件中的模型时出错

tensorflow - 是否可以在 tensorflow 神经网络输出节点之间实现数学约束?

python - TensorFlow对象检测API仅在框架的指定区域内(在输入框架中定义ROI)

machine-learning - 如何避免简单前馈网络的过度拟合