【Ubuntu-Tensorflow】InvalidArgumentError GPU不能使用的问题

6 篇文章 0 订阅
5 篇文章 0 订阅

问题内容如下
这里写图片描述

InvalidArgumentError (see above for traceback): Cannot assign a device to node 'train/final/fc3/b/Momentum': Could not satisfy explicit device specification '/device:GPU:0' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0
Colocation Debug Info:
Colocation group had the following types and devices: 
ApplyMomentum: CPU 
Mul: CPU 
Sum: CPU 
Abs: CPU 
Const: CPU 
Assign: CPU 
Identity: CPU 
VariableV2: CPU 
     [[Node: train/final/fc3/b/Momentum = VariableV2[_class=["loc:@train/final/fc3/b"], container="", dtype=DT_FLOAT, shape=[29], shared_name="", _device="/device:GPU:0"]()]]

问题原因:有些tf.Variable()不允许在GPU运行,需要在CPU运行
解决办法:修改配置里面的allow_soft_placement=True,而allow_soft_placement=True,就是运行在出现不允许在GPU运行的时候,可以切换到CPU运行。

【2017/8/9】20:20
经过一个下午的不断的调试认证,发现,allow_soft_placement=True,就是在GPU跑不动程序的时候,自动切换到CPU运行,这种方式虽然能够确保程序的正常运行,但是却不能保证GPU出现问题能够及时的反馈,故而还是推荐使用allow_soft_placement=True的选项。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

二十四桥下一句

您的鼓励是我最大的创作动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值