【问题标题】:AttributeError: module 'tensorflow._api.v1.config' has no attribute 'set_visible_devices'AttributeError:模块“tensorflow._api.v1.config”没有属性“set_visible_devices”
【发布时间】:2021-02-06 02:45:19
【问题描述】:
首先,很抱歉我的英语不好让您理解。
目前,我正在使用 tensorflow 1.14 版进行计算机视觉。在这个过程中,使用GPU旋转模型的过程中出现了如下问题。
AttributeError:模块“tensorflow._api.v1.config”没有属性“set_visible_devices”
目前的开发环境如下。
- Python:3.7.9
- 康达:4.8.3
- 张量流:1.14.0
- keras:2.3.1
另外,我目前有 4 个 gpu,我想像使用 1 个 gpu 一样使用 2 个 gpu。你能给我一个好主意吗?
谢谢。
【问题讨论】:
标签:
tensorflow
deep-learning
computer-vision
gpu
【解决方案1】:
看来你需要升级tensorflow,因为tf.config.set_visible_devices()函数在最新版本的tensorflow中可用,你可以使用下面的代码来升级tensorflow:
!pip install --upgrade pip.
!pip install --upgrade tensorflow
您可以按照link的要求安装tensorflow的CPU/GPU版本,tf.config.set_visible_devices()功能相关详情请查看here