Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3e57181e
提交
3e57181e
authored
11月 29, 2020
作者:
Michael Osthege
提交者:
Brandon T. Willard
12月 04, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move ContextParam class to theano.configparser
上级
dde33dc5
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
20 行增加
和
25 行删除
+20
-25
configdefaults.py
theano/configdefaults.py
+4
-25
configparser.py
theano/configparser.py
+16
-0
没有找到文件。
theano/configdefaults.py
浏览文件 @
3e57181e
...
...
@@ -17,6 +17,7 @@ from theano.configparser import (
AddConfigVar
,
BoolParam
,
ConfigParam
,
ContextsParam
,
DeviceParam
,
EnumStr
,
FloatParam
,
...
...
@@ -100,17 +101,15 @@ AddConfigVar(
in_c_key
=
False
,
)
# gpu means let the driver select the gpu. Needed in case of gpu in
# exclusive mode.
# gpuX mean use the gpu number X.
AddConfigVar
(
"device"
,
(
"Default device for computations. If cuda* or opencl*, change the"
"default to try to move computation to the GPU. Do not use upper case"
"letters, only lower case even if NVIDIA uses capital letters."
"letters, only lower case even if NVIDIA uses capital letters. "
"'gpu' means let the driver select the gpu (needed for gpu in exclusive mode). "
"'gpuX' mean use the gpu number X."
),
DeviceParam
(
"cpu"
,
mutable
=
False
),
in_c_key
=
False
,
...
...
@@ -152,26 +151,6 @@ AddConfigVar(
)
class
ContextsParam
(
ConfigParam
):
def
__init__
(
self
):
def
filter
(
val
):
if
val
==
""
:
return
val
for
v
in
val
.
split
(
";"
):
s
=
v
.
split
(
"->"
)
if
len
(
s
)
!=
2
:
raise
ValueError
(
f
"Malformed context map: {v}"
)
if
(
s
[
0
]
==
"cpu"
or
s
[
0
]
.
startswith
(
"cuda"
)
or
s
[
0
]
.
startswith
(
"opencl"
)
):
raise
ValueError
(
f
"Cannot use {s[0]} as context name"
)
return
val
ConfigParam
.
__init__
(
self
,
""
,
apply
=
filter
,
mutable
=
False
)
AddConfigVar
(
"contexts"
,
"""
...
...
theano/configparser.py
浏览文件 @
3e57181e
...
...
@@ -528,3 +528,19 @@ class DeviceParam(ConfigParam):
def
__str__
(
self
):
return
f
"{self.fullname} ({self.default}, opencl*, cuda*) "
class
ContextsParam
(
ConfigParam
):
def
__init__
(
self
):
super
()
.
__init__
(
""
,
apply
=
self
.
_apply
,
mutable
=
False
)
def
_apply
(
self
,
val
):
if
val
==
""
:
return
val
for
v
in
val
.
split
(
";"
):
s
=
v
.
split
(
"->"
)
if
len
(
s
)
!=
2
:
raise
ValueError
(
f
"Malformed context map: {v}"
)
if
s
[
0
]
==
"cpu"
or
s
[
0
]
.
startswith
(
"cuda"
)
or
s
[
0
]
.
startswith
(
"opencl"
):
raise
ValueError
(
f
"Cannot use {s[0]} as context name"
)
return
val
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论