我在这里找到了答案-https: //github.com/keras- team/keras/issues/13684。我load_model()
在Anaconda的keras遇到了同样的问题:
AttributeError:模块“ tensorflow_core._api.v2.config”没有属性“ experimental_list_devices”
我发现问题的根源
… \ anaconda3 \ envs \ tf_env \ Lib \ site-packages \ keras \ backend \ tensorflow_backend.py
在第506行中,我更改了行
_LOCAL_DEVICES = tf.config.experimental_list_devices()
至
devices = tf.config.list_logical_devices()
_LOCAL_DEVICES = [x.name for x in devices]
而且有效