{AttributeError:模块'tensorflow_core._api.v2.config'没有属性'experimental_list_devices'}我如何解决此错误? [英] { AttributeError: module 'tensorflow_core._api.v2.config' has no attribute 'experimental_list_devices' } how can i solve this error?
问题描述
Am在Windows 10上使用tensorflow 2.1.跑步
Am using tensorflow 2.1 on windows 10 . on running
model.add(Conv3D(16, (22, 5, 5), strides=(1, 2, 2), padding='valid',activation='relu',data_format= "channels_first", input_shape=input_shape))
在spyder上出现上述错误.我该如何解决这个错误?
on spyder I get the above error. How can i solve this error ??
推荐答案
I found the answer here - https://github.com/keras-team/keras/issues/13684.
I had the same issue for load_model()
from keras under Anaconda:
AttributeError:模块'tensorflow_core._api.v2.config'没有属性'experimental_list_devices'
AttributeError: module 'tensorflow_core._api.v2.config' has no attribute 'experimental_list_devices'
我在
... \ anaconda3 \ envs \ tf_env \ Lib \ site-packages \ keras \ backend \ tensorflow_backend.py
...\anaconda3\envs\tf_env\Lib\site-packages\keras\backend\tensorflow_backend.py
在506行中,我更改了行
In line 506 I changed line
_LOCAL_DEVICES = tf.config.experimental_list_devices()
到
devices = tf.config.list_logical_devices()
_LOCAL_DEVICES = [x.name for x in devices]
它有效
这篇关于{AttributeError:模块'tensorflow_core._api.v2.config'没有属性'experimental_list_devices'}我如何解决此错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!