Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
73575d81
提交
73575d81
authored
12月 02, 2011
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed the config.home option
This option was redundant with config.base_compiledir
上级
1efddab2
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
62 行增加
和
72 行删除
+62
-72
config.txt
doc/library/config.txt
+2
-15
configdefaults.py
theano/configdefaults.py
+27
-23
compiledir.py
theano/gof/compiledir.py
+33
-34
没有找到文件。
doc/library/config.txt
浏览文件 @
73575d81
...
@@ -273,23 +273,10 @@ import theano and print the config variable, as in:
...
@@ -273,23 +273,10 @@ import theano and print the config variable, as in:
This flag's value cannot be modified during the program execution.
This flag's value cannot be modified during the program execution.
.. attribute:: home
Default: On Linux: $HOME/.theano. On Windows: $LOCALAPPDATA\\Theano
This is the base directory where all Theano files are stored. Currently,
the only files being stored are compiled C modules, and thus changing ``home``
is similar to changing ``base_compiledir`` (described below).
Note however that ``home`` used to have a different meaning in previous
versions of Theano (up to 0.4.1), and to make sure its new meaning is
understood, it is currently forbidden to change ``home`` without also
changing either ``base_compiledir`` or ``compiledir``.
This flag's value cannot be modified during the program execution.
.. attribute:: base_compiledir
.. attribute:: base_compiledir
Default: ``config.home``
Default: On Windows: $LOCALAPPDATA\\Theano if $LOCALAPPDATA is defined,
otherwise and on other systems: ~/.theano.
This directory stores the architecture-dependent compilation directories.
This directory stores the architecture-dependent compilation directories.
...
...
theano/configdefaults.py
浏览文件 @
73575d81
...
@@ -3,7 +3,10 @@ import logging
...
@@ -3,7 +3,10 @@ import logging
import
subprocess
import
subprocess
import
sys
import
sys
from
theano.configparser
import
TheanoConfigParser
,
AddConfigVar
,
EnumStr
,
StrParam
,
IntParam
,
FloatParam
,
BoolParam
from
theano.configparser
import
(
AddConfigVar
,
BoolParam
,
ConfigParam
,
EnumStr
,
IntParam
,
FloatParam
,
StrParam
,
TheanoConfigParser
)
_logger
=
logging
.
getLogger
(
'theano.configdefaults'
)
_logger
=
logging
.
getLogger
(
'theano.configdefaults'
)
...
@@ -119,37 +122,38 @@ AddConfigVar('on_opt_error',
...
@@ -119,37 +122,38 @@ AddConfigVar('on_opt_error',
EnumStr
(
'warn'
,
'raise'
),
EnumStr
(
'warn'
,
'raise'
),
in_c_key
=
False
)
in_c_key
=
False
)
def
get_home_dir
():
home
=
os
.
getenv
(
'HOME'
)
def
safe_no_home
(
home
):
if
home
is
None
:
"""
# This expanduser usually works on Windows (see discussion on
Make sure the user is not attempting to use `config.home`.
# theano-users, July 13 2010).
home
=
os
.
path
.
expanduser
(
'~'
)
This config option was removed in Thenao 0.5 since it was redundant with
if
home
==
'~'
:
`config.base_compiledir`. This filter function ensures people who were
# This might happen when expanduser fails. Although the cause of
setting the location of their compilation directory through `config.home`
# failure is a mystery, it has been seen on some Windows system.
switch to `config.basecompiledir` instead, by raising an error when
home
=
os
.
getenv
(
'USERPROFILE'
)
`config.home` is used.
assert
home
is
not
None
"""
return
home
if
home
:
raise
RuntimeError
(
# On Windows we should avoid writing temporary files to a directory that is
'The `config.home` option has been removed and should not be '
# part of the roaming part of the user profile. Instead we use the local part
'used anymore. Please set the `config.base_compiledir` option '
# of the user profile, when available.
'instead (for instance to:
%
s)'
%
if
sys
.
platform
==
'win32'
and
os
.
getenv
(
'LOCALAPPDATA'
)
is
not
None
:
os
.
path
.
join
(
home
,
'.theano'
))
default_home
=
os
.
path
.
join
(
os
.
getenv
(
'LOCALAPPDATA'
),
'Theano'
)
return
True
else
:
default_home
=
os
.
path
.
join
(
get_home_dir
(),
'.theano'
)
AddConfigVar
(
'home'
,
AddConfigVar
(
'home'
,
"
Home directory for Theano files
"
,
"
This config option was removed in 0.5: do not use it!
"
,
StrParam
(
default_home
,
allow_override
=
Fals
e
),
ConfigParam
(
''
,
allow_override
=
False
,
filter
=
safe_no_hom
e
),
in_c_key
=
False
)
in_c_key
=
False
)
AddConfigVar
(
'nocleanup'
,
AddConfigVar
(
'nocleanup'
,
"Suppress the deletion of code files that did not compile cleanly"
,
"Suppress the deletion of code files that did not compile cleanly"
,
BoolParam
(
False
),
BoolParam
(
False
),
in_c_key
=
False
)
in_c_key
=
False
)
# This flag is used when we import Theano to initialize global variables.
# This flag is used when we import Theano to initialize global variables.
# So changing it after import will not modify these global variables.
# So changing it after import will not modify these global variables.
# This could be done differently... but for now we simply prevent it from being
# This could be done differently... but for now we simply prevent it from being
...
...
theano/gof/compiledir.py
浏览文件 @
73575d81
...
@@ -4,7 +4,6 @@ import os
...
@@ -4,7 +4,6 @@ import os
import
platform
import
platform
import
re
import
re
import
sys
import
sys
import
warnings
import
theano
import
theano
from
theano.configparser
import
config
,
AddConfigVar
,
ConfigParam
,
StrParam
from
theano.configparser
import
config
,
AddConfigVar
,
ConfigParam
,
StrParam
...
@@ -51,45 +50,45 @@ def filter_compiledir(path):
...
@@ -51,45 +50,45 @@ def filter_compiledir(path):
return
path
return
path
def
get_home_dir
():
"""
Return location of the user's home directory.
"""
home
=
os
.
getenv
(
'HOME'
)
if
home
is
None
:
# This expanduser usually works on Windows (see discussion on
# theano-users, July 13 2010).
home
=
os
.
path
.
expanduser
(
'~'
)
if
home
==
'~'
:
# This might happen when expanduser fails. Although the cause of
# failure is a mystery, it has been seen on some Windows system.
home
=
os
.
getenv
(
'USERPROFILE'
)
assert
home
is
not
None
return
home
# On Windows we should avoid writing temporary files to a directory that is
# part of the roaming part of the user profile. Instead we use the local part
# of the user profile, when available.
if
sys
.
platform
==
'win32'
and
os
.
getenv
(
'LOCALAPPDATA'
)
is
not
None
:
default_base_compiledir
=
os
.
path
.
join
(
os
.
getenv
(
'LOCALAPPDATA'
),
'Theano'
)
else
:
default_base_compiledir
=
os
.
path
.
join
(
get_home_dir
(),
'.theano'
)
AddConfigVar
(
'base_compiledir'
,
AddConfigVar
(
'base_compiledir'
,
"arch-independent cache directory for compiled modules"
,
"arch-independent cache directory for compiled modules"
,
StrParam
(
config
.
home
,
allow_override
=
False
))
StrParam
(
default_base_compiledir
,
allow_override
=
False
))
default_compiledir
=
os
.
path
.
join
(
os
.
path
.
expanduser
(
config
.
base_compiledir
),
default_compiledirname
())
AddConfigVar
(
'compiledir'
,
AddConfigVar
(
'compiledir'
,
"arch-dependent cache directory for compiled modules"
,
"arch-dependent cache directory for compiled modules"
,
ConfigParam
(
default_compiledir
,
ConfigParam
(
filter
=
filter_compiledir
,
os
.
path
.
join
(
allow_override
=
False
))
os
.
path
.
expanduser
(
config
.
base_compiledir
),
default_compiledirname
()),
filter
=
filter_compiledir
,
# The role of `config.home` was changed compared to Theano 0.4.1. It used to
allow_override
=
False
))
# be the location of the user home directory. Now, it directly points to the
# directory where Theano should save its own data files. Typically, the
# difference is that it now includes the '.theano' folder, while it used to be
# the parent of that folder. In order for this change to be safe, we currently
# prevent people from changing `config.home` unless they also change
# the compilation directory.
if
(
config
.
home
!=
theano
.
configdefaults
.
default_home
and
config
.
base_compiledir
==
config
.
home
and
# We need to compare to the `real` path because this is what is used in
# `filter_compiledir`.
config
.
compiledir
==
os
.
path
.
realpath
(
default_compiledir
)):
# The user changed `config.home` but is still using the default values for
# `config.base_compiledir` and `config.compiledir`.
raise
RuntimeError
(
'You manually set your Theano home directory (to
%
s), but kept '
'the default compilation directory. Please note that the meaning '
'of the `home` directory was changed: it is now the base '
'directory for all Theano files, instead of being its parent '
'directory. To get rid of this error, please set the '
'`base_compiledir` config option to the directory you want '
'compiled files to be stored into (for instance:
%
s).'
%
(
config
.
home
,
os
.
path
.
join
(
config
.
home
,
'.theano'
)))
def
print_compiledir_content
():
def
print_compiledir_content
():
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论