Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
cdaaf137
提交
cdaaf137
authored
2月 18, 2013
作者:
lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1232 from nouiz/lazy_config_default_value
Lazy config default value
上级
6e4ae3ee
5d2cdfb8
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
19 行增加
和
7 行删除
+19
-7
configparser.py
theano/configparser.py
+18
-6
blas.py
theano/tensor/blas.py
+1
-1
没有找到文件。
theano/configparser.py
浏览文件 @
cdaaf137
...
@@ -126,7 +126,7 @@ def _config_print(thing, buf):
...
@@ -126,7 +126,7 @@ def _config_print(thing, buf):
for
cv
in
_config_var_list
:
for
cv
in
_config_var_list
:
print
>>
buf
,
cv
print
>>
buf
,
cv
print
>>
buf
,
" Doc: "
,
cv
.
doc
print
>>
buf
,
" Doc: "
,
cv
.
doc
print
>>
buf
,
" Value: "
,
cv
.
val
print
>>
buf
,
" Value: "
,
cv
.
__get__
()
print
>>
buf
,
""
print
>>
buf
,
""
...
@@ -141,7 +141,7 @@ def get_config_md5():
...
@@ -141,7 +141,7 @@ def get_config_md5():
all_opts
=
sorted
([
c
for
c
in
_config_var_list
if
c
.
in_c_key
],
all_opts
=
sorted
([
c
for
c
in
_config_var_list
if
c
.
in_c_key
],
key
=
lambda
cv
:
cv
.
fullname
)
key
=
lambda
cv
:
cv
.
fullname
)
return
theano
.
gof
.
cc
.
hash_from_code
(
'
\n
'
.
join
(
return
theano
.
gof
.
cc
.
hash_from_code
(
'
\n
'
.
join
(
[
'
%
s =
%
s'
%
(
cv
.
fullname
,
cv
.
val
)
for
cv
in
all_opts
]))
[
'
%
s =
%
s'
%
(
cv
.
fullname
,
cv
.
__get__
()
)
for
cv
in
all_opts
]))
class
TheanoConfigParser
(
object
):
class
TheanoConfigParser
(
object
):
...
@@ -226,8 +226,18 @@ def AddConfigVar(name, doc, configparam, root=config, in_c_key=True):
...
@@ -226,8 +226,18 @@ def AddConfigVar(name, doc, configparam, root=config, in_c_key=True):
configparam
.
fullname
)
configparam
.
fullname
)
configparam
.
doc
=
doc
configparam
.
doc
=
doc
configparam
.
in_c_key
=
in_c_key
configparam
.
in_c_key
=
in_c_key
# trigger a read of the value from config files and env vars
# Trigger a read of the value from config files and env vars
configparam
.
__get__
()
# This allow to filter wrong value from the user.
if
not
callable
(
configparam
.
default
):
configparam
.
__get__
()
else
:
# We do not want to evaluate now the default value when it is a callable.
try
:
fetch_val_for_key
(
configparam
.
fullname
)
# The user provided a value, filter it now.
configparam
.
__get__
()
except
KeyError
:
pass
setattr
(
root
.
__class__
,
sections
[
0
],
configparam
)
setattr
(
root
.
__class__
,
sections
[
0
],
configparam
)
_config_var_list
.
append
(
configparam
)
_config_var_list
.
append
(
configparam
)
...
@@ -253,12 +263,14 @@ class ConfigParam(object):
...
@@ -253,12 +263,14 @@ class ConfigParam(object):
# invalid and causes a crash or has unwanted side effects.
# invalid and causes a crash or has unwanted side effects.
def
__get__
(
self
,
*
args
):
def
__get__
(
self
,
*
args
):
#print "GETTING PARAM", self.fullname, self, args
if
not
hasattr
(
self
,
'val'
):
if
not
hasattr
(
self
,
'val'
):
try
:
try
:
val_str
=
fetch_val_for_key
(
self
.
fullname
)
val_str
=
fetch_val_for_key
(
self
.
fullname
)
except
KeyError
:
except
KeyError
:
val_str
=
self
.
default
if
callable
(
self
.
default
):
val_str
=
self
.
default
()
else
:
val_str
=
self
.
default
self
.
__set__
(
None
,
val_str
)
self
.
__set__
(
None
,
val_str
)
#print "RVAL", self.val
#print "RVAL", self.val
return
self
.
val
return
self
.
val
...
...
theano/tensor/blas.py
浏览文件 @
cdaaf137
...
@@ -390,7 +390,7 @@ def default_blas_ldflags():
...
@@ -390,7 +390,7 @@ def default_blas_ldflags():
AddConfigVar
(
'blas.ldflags'
,
AddConfigVar
(
'blas.ldflags'
,
"lib[s] to include for [Fortran] level-3 blas implementation"
,
"lib[s] to include for [Fortran] level-3 blas implementation"
,
StrParam
(
default_blas_ldflags
()
))
StrParam
(
default_blas_ldflags
))
@utils.memoize
@utils.memoize
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论