【发布时间】:2017-03-14 23:14:35
【问题描述】:
我一直按照setting up keras on GPU 的说明进行操作。这就是我按照方法3的建议所做的。
import theano
theano.config.device = 'gpu'
theano.config.floatX = 'float32'
但是,我收到以下错误消息
Using Theano backend.
Traceback (most recent call last):
File "train.py", line 17, in
theano.config.device = 'gpu'
File "/devl/geophys/dplearn/tensorflow/tf_0.12/lib/python3.4/site-
packages/theano/configparser.py", line 338, in set
"Can't change the value of this config parameter "
Exception: Can't change the value of this config parameter after initialization!
【问题讨论】:
-
你可以在调用python时尝试这样做:THEANO_FLAGS=device=gpu,floatX=float32 python my_program.py
-
或者你可以在
home目录中创建一个 .theanorc 文件。另外请将“gpu”更改为“gpu0”或“gpu1”,看看会发生什么。