属性错误:模块';tensorflow_core._api.v2.config';没有属性';列出物理设备和x27;

属性错误:模块';tensorflow_core._api.v2.config';没有属性';列出物理设备和x27;,tensorflow,tensorflow2.0,Tensorflow,Tensorflow2.0,我在Ubuntu 18.04上使用Tensorflow 2.0。跑步时 tf.config.list_physical_devices('GPU') 我得到了上面的错误。解决方法是什么?运行tf.config.experimental.list\u物理设备('GPU')以查看所有GPU 或 运行tf.config.experimental.list\u physical\u devices(device\u type=None)查看所有设备 您还可以使用tf.test.is\u gpu\u a

我在Ubuntu 18.04上使用Tensorflow 2.0。跑步时

tf.config.list_physical_devices('GPU')

我得到了上面的错误。解决方法是什么?

运行
tf.config.experimental.list\u物理设备('GPU')
以查看所有GPU

运行
tf.config.experimental.list\u physical\u devices(device\u type=None)
查看所有设备

您还可以使用
tf.test.is\u gpu\u available()
。如果检测到可用的gpu,则表示为True