module 'tensorflow_core._api.v2.config' has no attribute 'experimental_list_devices'
Posted Howbin
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了module 'tensorflow_core._api.v2.config' has no attribute 'experimental_list_devices'相关的知识,希望对你有一定的参考价值。
module \'tensorflow_core._api.v2.config\' has no attribute \'experimental_list_devices\'
![](https://image.cha138.com/20210513/5dfbe80f95234ab8b86e17cd54eb2acd.jpg)
报错如下
建立CNN层时出错:
module ‘tensorflow_core._api.v2.config’ has no attribute ‘experimental_list_devices’
![错误 错误](https://image.cha138.com/20210513/2a2b0b1be7fc4ba9accafc27ccd94c14.jpg)
错误
环境
- keras cup版本
- Anaconda
解决方法
找到如下图路径:
修改506行:
_LOCAL_DEVICES = tf.config.experimental_list_devices()
为
devices = tf.config.list_logical_devices()
_LOCAL_DEVICES = [x.name for x in devices]
参考
以上是关于module 'tensorflow_core._api.v2.config' has no attribute 'experimental_list_devices'的主要内容,如果未能解决你的问题,请参考以下文章
AttributeError: module 'pip' has no attribute 'main'如何解决?
Error: Cannot find module 'gulp-sass'
python 3.x报错:No module named 'cookielib'或No module named 'urllib2'
module 'scipy.misc' has no attribute 'toimage',python
Cannot find module '@babel/plugin-transform-react-jsx' 和Cannot find module '@babel/core&