module 'tensorflow_core._api.v2.config' has no attribute 'list_physical_devices'

这个错误发生在TensorFlow2.0版本中,查看了源码之后解决如下

tensorflow_core._api.v2.config下只有如下的文件

tf.config.list_logical_devices报错module 'tensorflow_core._api.v2.config' has no attribute 'list_**

而list_physical_devices在experimental文件中被导入

tf.config.list_logical_devices报错module 'tensorflow_core._api.v2.config' has no attribute 'list_**

所以只要将代码修改之后即可解决,如下

原始:

tf.config.list_logical_devices()

修改后:

tf.config.experimental.list_logical_devices()

亲测解决

 

相关文章:

  • 2021-12-16
  • 2021-08-04
  • 2021-11-25
  • 2021-09-15
  • 2022-12-23
  • 2022-12-23
  • 2021-04-07
  • 2021-11-21
猜你喜欢
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2021-09-02
相关资源
相似解决方案