Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d3da0a2d
提交
d3da0a2d
authored
7月 31, 2013
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move DeviceParam to configdefaults.py
上级
86e48dc9
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
21 行增加
和
23 行删除
+21
-23
configdefaults.py
theano/configdefaults.py
+21
-3
configparser.py
theano/configparser.py
+0
-20
没有找到文件。
theano/configdefaults.py
浏览文件 @
d3da0a2d
...
@@ -2,9 +2,8 @@ import os
...
@@ -2,9 +2,8 @@ import os
import
logging
import
logging
import
subprocess
import
subprocess
from
theano.configparser
import
(
from
theano.configparser
import
(
AddConfigVar
,
BoolParam
,
ConfigParam
,
EnumStr
,
AddConfigVar
,
BoolParam
,
ConfigParam
,
DeviceParam
,
EnumStr
,
IntParam
,
IntParam
,
StrParam
,
TheanoConfigParser
)
StrParam
,
TheanoConfigParser
)
from
theano.misc.cpucount
import
cpuCount
from
theano.misc.cpucount
import
cpuCount
from
theano.misc.windows
import
call_subprocess_Popen
from
theano.misc.windows
import
call_subprocess_Popen
...
@@ -44,6 +43,25 @@ AddConfigVar('int_division',
...
@@ -44,6 +43,25 @@ AddConfigVar('int_division',
# gpu means let the driver select the gpu. Needed in case of gpu in
# gpu means let the driver select the gpu. Needed in case of gpu in
# exclusive mode.
# exclusive mode.
# gpuX mean use the gpu number X.
# gpuX mean use the gpu number X.
class
DeviceParam
(
ConfigParam
):
def
__init__
(
self
,
default
,
*
options
,
**
kwargs
):
self
.
default
=
default
def
filter
(
val
):
if
val
.
startswith
(
'cpu'
)
or
val
.
startswith
(
'gpu'
)
\
or
val
.
startswith
(
'opencl'
)
or
val
.
startswith
(
'cuda'
):
return
val
else
:
raise
ValueError
((
'Invalid value ("
%
s") for configuration '
'variable "
%
s". Valid options start with '
'one of "cpu", "gpu", "opencl", "cuda"'
%
(
val
,
self
.
fullname
)))
over
=
kwargs
.
get
(
"allow_override"
,
True
)
super
(
DeviceParam
,
self
)
.
__init__
(
default
,
filter
,
over
)
def
__str__
(
self
):
return
'
%
s (cpu, gpu*, opencl*, cuda*) '
%
(
self
.
fullname
,)
AddConfigVar
(
'device'
,
AddConfigVar
(
'device'
,
(
"Default device for computations. If gpu*, change the default to try "
(
"Default device for computations. If gpu*, change the default to try "
"to move computation to it and to put shared variable of float32 "
"to move computation to it and to put shared variable of float32 "
...
...
theano/configparser.py
浏览文件 @
d3da0a2d
...
@@ -314,26 +314,6 @@ class EnumStr(ConfigParam):
...
@@ -314,26 +314,6 @@ class EnumStr(ConfigParam):
return
'
%
s (
%
s) '
%
(
self
.
fullname
,
self
.
all
)
return
'
%
s (
%
s) '
%
(
self
.
fullname
,
self
.
all
)
class
DeviceParam
(
ConfigParam
):
def
__init__
(
self
,
default
,
*
options
,
**
kwargs
):
self
.
default
=
default
def
filter
(
val
):
if
val
.
startswith
(
'cpu'
)
or
val
.
startswith
(
'gpu'
)
\
or
val
.
startswith
(
'opencl'
)
or
val
.
startswith
(
'cuda'
):
return
val
else
:
raise
ValueError
((
'Invalid value ("
%
s") for configuration '
'variable "
%
s". Valid options start with '
'one of "cpu", "gpu", "opencl", "cuda"'
%
(
val
,
self
.
fullname
)))
over
=
kwargs
.
get
(
"allow_override"
,
True
)
super
(
DeviceParam
,
self
)
.
__init__
(
default
,
filter
,
over
)
def
__str__
(
self
):
return
'
%
s (cpu, gpu*, opencl*, cuda*) '
%
(
self
.
fullname
,)
class
TypedParam
(
ConfigParam
):
class
TypedParam
(
ConfigParam
):
def
__init__
(
self
,
default
,
mytype
,
is_valid
=
None
,
allow_override
=
True
):
def
__init__
(
self
,
default
,
mytype
,
is_valid
=
None
,
allow_override
=
True
):
self
.
mytype
=
mytype
self
.
mytype
=
mytype
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论