{ AttributeError: module 'tensorflow_core._api.v2.config' has no attribute 'experimental_list_devices' } how can i solve this error?

会有一股神秘感。 提交于 2020-04-18 12:31:35

问题


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))

on spyder I get the above error. How can i solve this error ??


回答1:


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: module 'tensorflow_core._api.v2.config' has no attribute 'experimental_list_devices'

I found source of problem in

...\anaconda3\envs\tf_env\Lib\site-packages\keras\backend\tensorflow_backend.py

In line 506 I changed line

_LOCAL_DEVICES = tf.config.experimental_list_devices()

to

devices = tf.config.list_logical_devices()

_LOCAL_DEVICES = [x.name for x in devices]

And it works



来源:https://stackoverflow.com/questions/60581677/attributeerror-module-tensorflow-core-api-v2-config-has-no-attribute-expe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!