gpt4 book ai didi

python - tensorflow_core._api.v2.config中缺少experimental_list_devices属性

转载 作者:行者123 更新时间:2023-12-03 15:11:50 27 4
gpt4 key购买 nike

我正在Windows 10上使用tensorflow 2.1

model.add(Conv3D(16, (22, 5, 5), strides=(1, 2, 2), padding='valid',activation='relu',data_format= "channels_first", input_shape=input_shape))

在spyder上,出现以下错误:
{ AttributeError: module 'tensorflow_core._api.v2.config' has no attribute 'experimental_list_devices' }
我该如何解决这个错误?

最佳答案

我在这里找到了答案-https://github.com/keras-team/keras/issues/13684
我对Anaconda下的keras的load_model()有相同的问题:

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



在第506行中,我更改了行
_LOCAL_DEVICES = tf.config.experimental_list_devices()


devices = tf.config.list_logical_devices()

_LOCAL_DEVICES = [x.name for x in devices]

它有效

关于python - tensorflow_core._api.v2.config中缺少experimental_list_devices属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60581677/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com