tensorflow_core._api.v2.config 中缺少experimental_list_devices 属性 [英] experimental_list_devices attribute missing in tensorflow_core._api.v2.config
问题描述
我在 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 this error:
{ AttributeError: module 'tensorflow_core._api.v2.config' has no attribute 'experimental_list_devices' }
我该如何解决这个错误?
How can I solve this error?
推荐答案
我在这里找到了答案 - https://github.com/keras-team/keras/issues/13684.我在 Anaconda 下对来自 keras 的 load_model()
有同样的问题:
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:
属性错误:模块tensorflow_core._api.v2.config"没有属性experimental_list_devices"
AttributeError: module 'tensorflow_core._api.v2.config' has no attribute 'experimental_list_devices'
我在
...anaconda3envs f_envLibsite-packageskerasackend ensorflow_backend.py
...anaconda3envs f_envLibsite-packageskerasackend ensorflow_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]
它有效
这篇关于tensorflow_core._api.v2.config 中缺少experimental_list_devices 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!