如何设置theano配置

era*_*ran 34 theano

我是Theano的新手.尝试设置配置文件.

首先,我注意到我没有.theanorc文件:

  1. locate .theanorc - 什么都不返回
  2. echo $THEANORC - 什么都不返回
  3. theano.test() - 通过确定

我猜测我安装了theano时创建了一些默认配置.它在哪里?

nou*_*uiz 44

Theano本身不创建任何配置文件,但其所有配置标志都有默认值.如果要修改默认值,则只需要这样的文件.

这可以通过在主目录中创建.theanorc文件来完成.例如,如果您希望floatX始终为float32,则可以执行以下操作:

echo -e "\n[global]\nfloatX=float32\n" >> ~/.theanorc
Run Code Online (Sandbox Code Playgroud)

在Linux和Mac下.在Windows下,这也可以完成.有关详细信息,请参阅此页面:

http://deeplearning.net/software/theano/library/config.html


小智 8

在Linux中的终端主页目录中写道:

nano .theanorc
Run Code Online (Sandbox Code Playgroud)

在文件中复制以下行

[global]
floatX = float32
device = gpu0

[lib]
cnmem = 1   
Run Code Online (Sandbox Code Playgroud)

保存.

当我在python中导入theano时,我遇到了cnmem内存问题.似乎是因为监视器连接到gpu.要解决它,请将cnmem更改为0.8.这个数字低于1是为theano保留的gpu的百分比