tensorflow_core._api.v2.config中缺少experimental_list_devices属性 [英] experimental_list_devices attribute missing in tensorflow_core._api.v2.config

查看:451
本文介绍了tensorflow_core._api.v2.config中缺少experimental_list_devices属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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' }

如何解决此错误?

推荐答案

我在这里找到了答案-

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]

它有效

这篇关于tensorflow_core._api.v2.config中缺少experimental_list_devices属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆