Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c84494b8
提交
c84494b8
authored
12月 08, 2020
作者:
Michael Osthege
提交者:
Brandon T. Willard
12月 09, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename ConfigParam.fullname to ConfigParam.name
上级
0e47020a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
13 行增加
和
13 行删除
+13
-13
configparser.py
theano/configparser.py
+13
-13
没有找到文件。
theano/configparser.py
浏览文件 @
c84494b8
...
...
@@ -130,12 +130,12 @@ class TheanoConfigParser:
"""
all_opts
=
sorted
(
[
c
for
c
in
self
.
_config_var_dict
.
values
()
if
c
.
in_c_key
],
key
=
lambda
cv
:
cv
.
full
name
,
key
=
lambda
cv
:
cv
.
name
,
)
return
_hash_from_code
(
"
\n
"
.
join
(
[
"{} = {}"
.
format
(
cv
.
full
name
,
cv
.
__get__
(
self
,
self
.
__class__
))
"{} = {}"
.
format
(
cv
.
name
,
cv
.
__get__
(
self
,
self
.
__class__
))
for
cv
in
all_opts
]
)
...
...
@@ -170,7 +170,7 @@ class TheanoConfigParser:
if
hasattr
(
self
,
name
):
raise
AttributeError
(
f
"The name {name} is already taken"
)
configparam
.
doc
=
doc
configparam
.
full
name
=
name
configparam
.
name
=
name
configparam
.
in_c_key
=
in_c_key
# Trigger a read of the value from config files and env vars
# This allow to filter wrong value from the user.
...
...
@@ -296,7 +296,7 @@ class ConfigParam:
self
.
_mutable
=
mutable
self
.
is_default
=
True
# set by TheanoConfigParser.add:
self
.
full
name
=
None
self
.
name
=
None
self
.
doc
=
None
self
.
in_c_key
=
None
...
...
@@ -336,7 +336,7 @@ class ConfigParam:
return
True
if
self
.
_validate
(
value
)
is
False
:
raise
ValueError
(
f
"Invalid value ({value}) for configuration variable '{self.
full
name}'."
f
"Invalid value ({value}) for configuration variable '{self.name}'."
)
return
True
...
...
@@ -345,7 +345,7 @@ class ConfigParam:
return
self
if
not
hasattr
(
self
,
"val"
):
try
:
val_str
=
cls
.
fetch_val_for_key
(
self
.
full
name
,
delete_key
=
delete_key
)
val_str
=
cls
.
fetch_val_for_key
(
self
.
name
,
delete_key
=
delete_key
)
self
.
is_default
=
False
except
KeyError
:
if
callable
(
self
.
default
):
...
...
@@ -358,7 +358,7 @@ class ConfigParam:
def
__set__
(
self
,
cls
,
val
):
if
not
self
.
mutable
and
hasattr
(
self
,
"val"
):
raise
Exception
(
"Can't change the value of {self.
full
name} config parameter after initialization!"
"Can't change the value of {self.name} config parameter after initialization!"
)
applied
=
self
.
apply
(
val
)
self
.
validate
(
applied
)
...
...
@@ -396,18 +396,18 @@ class EnumStr(ConfigParam):
return
val
else
:
raise
ValueError
(
f
"Invalid value ('{val}') for configuration variable '{self.
full
name}'. "
f
"Invalid value ('{val}') for configuration variable '{self.name}'. "
f
"Valid options are {self.all}"
)
def
__str__
(
self
):
return
f
"{self.
full
name} ({self.all}) "
return
f
"{self.name} ({self.all}) "
class
TypedParam
(
ConfigParam
):
def
__str__
(
self
):
# The "_apply" callable is the type itself.
return
f
"{self.
full
name} ({self._apply}) "
return
f
"{self.name} ({self._apply}) "
class
StrParam
(
TypedParam
):
...
...
@@ -440,7 +440,7 @@ class BoolParam(TypedParam):
elif
value
in
{
True
,
1
,
"true"
,
"True"
,
"1"
}:
return
True
raise
ValueError
(
f
"Invalid value ({value}) for configuration variable '{self.
full
name}'."
f
"Invalid value ({value}) for configuration variable '{self.name}'."
)
...
...
@@ -463,12 +463,12 @@ class DeviceParam(ConfigParam):
else
:
raise
ValueError
(
'Invalid value ("{val}") for configuration '
'variable "{self.
full
name}". Valid options start with '
'variable "{self.name}". Valid options start with '
'one of "cpu", "opencl" or "cuda".'
)
def
__str__
(
self
):
return
f
"{self.
full
name} ({self.default}, opencl*, cuda*) "
return
f
"{self.name} ({self.default}, opencl*, cuda*) "
class
ContextsParam
(
ConfigParam
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论