Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0ad41ce5
提交
0ad41ce5
authored
9月 30, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Changes following review.
上级
fe2123da
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
22 行增加
和
19 行删除
+22
-19
configdefaults.py
theano/configdefaults.py
+4
-3
__init__.py
theano/sandbox/cuda/__init__.py
+3
-0
conv.py
theano/sandbox/gpuarray/conv.py
+1
-1
dnn.py
theano/sandbox/gpuarray/dnn.py
+0
-1
elemwise.py
theano/sandbox/gpuarray/elemwise.py
+5
-5
neighbours.py
theano/sandbox/gpuarray/neighbours.py
+1
-1
nnet.py
theano/sandbox/gpuarray/nnet.py
+4
-4
subtensor.py
theano/sandbox/gpuarray/subtensor.py
+1
-1
type.py
theano/sandbox/gpuarray/type.py
+3
-3
没有找到文件。
theano/configdefaults.py
浏览文件 @
0ad41ce5
...
@@ -79,13 +79,13 @@ class DeviceParam(ConfigParam):
...
@@ -79,13 +79,13 @@ class DeviceParam(ConfigParam):
else
:
else
:
raise
ValueError
((
'Invalid value ("
%
s") for configuration '
raise
ValueError
((
'Invalid value ("
%
s") for configuration '
'variable "
%
s". Valid options start with '
'variable "
%
s". Valid options start with '
'one of "gpu", "opencl", "cuda"'
'one of "
%
s", "
gpu", "opencl", "cuda"'
%
(
val
,
self
.
fullname
)))
%
(
self
.
default
,
val
,
self
.
fullname
)))
over
=
kwargs
.
get
(
"allow_override"
,
True
)
over
=
kwargs
.
get
(
"allow_override"
,
True
)
super
(
DeviceParam
,
self
)
.
__init__
(
default
,
filter
,
over
)
super
(
DeviceParam
,
self
)
.
__init__
(
default
,
filter
,
over
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'
%
s (gpu*, opencl*, cuda*) '
%
(
self
.
fullname
,
self
.
default
)
return
'
%
s (
%
s,
gpu*, opencl*, cuda*) '
%
(
self
.
fullname
,
self
.
default
)
AddConfigVar
(
AddConfigVar
(
'device'
,
'device'
,
...
@@ -208,6 +208,7 @@ AddConfigVar('dnn.conv.algo_bwd',
...
@@ -208,6 +208,7 @@ AddConfigVar('dnn.conv.algo_bwd',
'time_on_shape_change'
),
'time_on_shape_change'
),
in_c_key
=
False
)
in_c_key
=
False
)
def
default_dnn_path
(
suffix
):
def
default_dnn_path
(
suffix
):
def
f
(
suffix
=
suffix
):
def
f
(
suffix
=
suffix
):
if
config
.
cuda
.
root
==
''
:
if
config
.
cuda
.
root
==
''
:
...
...
theano/sandbox/cuda/__init__.py
浏览文件 @
0ad41ce5
...
@@ -536,6 +536,9 @@ def handle_shared_float32(tf):
...
@@ -536,6 +536,9 @@ def handle_shared_float32(tf):
if
config
.
device
.
startswith
(
'gpu'
):
if
config
.
device
.
startswith
(
'gpu'
):
use
(
device
=
config
.
device
,
force
=
config
.
force_device
,
test_driver
=
False
)
use
(
device
=
config
.
device
,
force
=
config
.
force_device
,
test_driver
=
False
)
elif
config
.
init_gpu_device
.
startswith
(
'gpu'
):
elif
config
.
init_gpu_device
.
startswith
(
'gpu'
):
assert
config
.
device
==
"cpu"
,
(
"We can use the Theano flag init_gpu_device"
" only when the Theano flag device=='cpu'"
)
_logger
.
warning
((
"GPU device
%
s will be initialized, and used if a GPU is "
_logger
.
warning
((
"GPU device
%
s will be initialized, and used if a GPU is "
"needed. "
"needed. "
"However, no computation, nor shared variables, will be implicitly "
"However, no computation, nor shared variables, will be implicitly "
...
...
theano/sandbox/gpuarray/conv.py
浏览文件 @
0ad41ce5
...
@@ -232,7 +232,7 @@ class GpuConv(GpuKernelBase, gof.Op):
...
@@ -232,7 +232,7 @@ class GpuConv(GpuKernelBase, gof.Op):
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
# raise this whenever modifying any of the support_code_files
# raise this whenever modifying any of the support_code_files
return
(
0
,
2
1
)
return
(
0
,
2
2
)
def
c_code
(
self
,
node
,
nodename
,
inp
,
out_
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out_
,
sub
):
img
,
kern
=
inp
img
,
kern
=
inp
...
...
theano/sandbox/gpuarray/dnn.py
浏览文件 @
0ad41ce5
...
@@ -29,7 +29,6 @@ from .opt import gpu_seqopt, register_opt, conv_groupopt, op_lifter
...
@@ -29,7 +29,6 @@ from .opt import gpu_seqopt, register_opt, conv_groupopt, op_lifter
from
.opt_util
import
alpha_merge
,
output_merge
,
inplace_allocempty
from
.opt_util
import
alpha_merge
,
output_merge
,
inplace_allocempty
def
dnn_available
():
def
dnn_available
():
if
dnn_available
.
avail
is
not
None
:
if
dnn_available
.
avail
is
not
None
:
return
dnn_available
.
avail
return
dnn_available
.
avail
...
...
theano/sandbox/gpuarray/elemwise.py
浏览文件 @
0ad41ce5
...
@@ -437,7 +437,7 @@ class GpuElemwise(GpuKernelBase, HideC, Elemwise):
...
@@ -437,7 +437,7 @@ class GpuElemwise(GpuKernelBase, HideC, Elemwise):
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
ver
=
self
.
scalar_op
.
c_code_cache_version
()
ver
=
self
.
scalar_op
.
c_code_cache_version
()
if
ver
:
if
ver
:
return
(
3
,
ver
)
return
(
4
,
ver
)
else
:
else
:
return
ver
return
ver
...
@@ -542,7 +542,7 @@ class GpuDimShuffle(HideC, DimShuffle):
...
@@ -542,7 +542,7 @@ class GpuDimShuffle(HideC, DimShuffle):
return
process
return
process
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
4
,)
return
(
5
,)
class
GpuCAReduceCuda
(
GpuKernelBase
,
HideC
,
CAReduceDtype
):
class
GpuCAReduceCuda
(
GpuKernelBase
,
HideC
,
CAReduceDtype
):
...
@@ -791,7 +791,7 @@ class GpuCAReduceCuda(GpuKernelBase, HideC, CAReduceDtype):
...
@@ -791,7 +791,7 @@ class GpuCAReduceCuda(GpuKernelBase, HideC, CAReduceDtype):
Py_XDECREF(
%(z)
s);
Py_XDECREF(
%(z)
s);
%(z)
s = pygpu_empty(
%(nd_out)
s, new_dims,
%(z)
s = pygpu_empty(
%(nd_out)
s, new_dims,
%(out_typecode)
s, GA_C_ORDER,
%(out_typecode)
s, GA_C_ORDER,
%(ctx)
s
, Py_None);
pygpu_default_context()
, Py_None);
if (NULL ==
%(z)
s)
if (NULL ==
%(z)
s)
{
{
PyErr_Format(PyExc_RuntimeError, "Failed to allocate output");
PyErr_Format(PyExc_RuntimeError, "Failed to allocate output");
...
@@ -1911,7 +1911,7 @@ class GpuCAReduceCuda(GpuKernelBase, HideC, CAReduceDtype):
...
@@ -1911,7 +1911,7 @@ class GpuCAReduceCuda(GpuKernelBase, HideC, CAReduceDtype):
"""
%
locals
(),
file
=
sio
)
"""
%
locals
(),
file
=
sio
)
def
c_code_cache_version_apply
(
self
,
node
):
def
c_code_cache_version_apply
(
self
,
node
):
version
=
[
1
6
]
# the version corresponding to the c code in this Op
version
=
[
1
7
]
# the version corresponding to the c code in this Op
# now we insert versions for the ops on which we depend...
# now we insert versions for the ops on which we depend...
version
.
extend
(
self
.
scalar_op
.
c_code_cache_version
())
version
.
extend
(
self
.
scalar_op
.
c_code_cache_version
())
...
@@ -2884,7 +2884,7 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
...
@@ -2884,7 +2884,7 @@ class GpuCAReduceCPY(GpuKernelBase, HideC, CAReduceDtype):
return
code
return
code
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
1
,
self
.
GpuKernelBase_version
)
return
(
2
,
self
.
GpuKernelBase_version
)
def
generate_kernel
(
self
,
node
,
odtype
,
redux
):
def
generate_kernel
(
self
,
node
,
odtype
,
redux
):
if
isinstance
(
self
.
scalar_op
,
scalar
.
basic
.
Add
):
if
isinstance
(
self
.
scalar_op
,
scalar
.
basic
.
Add
):
...
...
theano/sandbox/gpuarray/neighbours.py
浏览文件 @
0ad41ce5
...
@@ -40,7 +40,7 @@ class GpuImages2Neibs(GpuKernelBase, Images2Neibs, Op):
...
@@ -40,7 +40,7 @@ class GpuImages2Neibs(GpuKernelBase, Images2Neibs, Op):
dtype
=
ten4
.
type
.
dtype
)()])
dtype
=
ten4
.
type
.
dtype
)()])
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
1
0
,
1
)
return
(
1
1
,
)
def
c_headers
(
self
):
def
c_headers
(
self
):
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
...
...
theano/sandbox/gpuarray/nnet.py
浏览文件 @
0ad41ce5
...
@@ -293,7 +293,7 @@ class GpuCrossentropySoftmaxArgmax1HotWithBias(GpuKernelBase, Op):
...
@@ -293,7 +293,7 @@ class GpuCrossentropySoftmaxArgmax1HotWithBias(GpuKernelBase, Op):
return
sio
.
getvalue
()
return
sio
.
getvalue
()
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
7
,)
return
(
8
,)
gpu_crossentropy_softmax_argmax_1hot_with_bias
=
GpuCrossentropySoftmaxArgmax1HotWithBias
()
gpu_crossentropy_softmax_argmax_1hot_with_bias
=
GpuCrossentropySoftmaxArgmax1HotWithBias
()
...
@@ -319,7 +319,7 @@ class GpuCrossentropySoftmax1HotWithBiasDx(GpuKernelBase, Op):
...
@@ -319,7 +319,7 @@ class GpuCrossentropySoftmax1HotWithBiasDx(GpuKernelBase, Op):
return
Apply
(
self
,
[
dnll
,
sm
,
y_idx
],
[
sm
.
type
()])
return
Apply
(
self
,
[
dnll
,
sm
,
y_idx
],
[
sm
.
type
()])
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
1
0
,)
return
(
1
1
,)
def
c_headers
(
self
):
def
c_headers
(
self
):
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
...
@@ -524,7 +524,7 @@ class GpuSoftmax(GpuKernelBase, Op):
...
@@ -524,7 +524,7 @@ class GpuSoftmax(GpuKernelBase, Op):
return
shape
return
shape
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
1
4
,)
+
inline_softmax
.
code_version
return
(
1
5
,)
+
inline_softmax
.
code_version
def
c_headers
(
self
):
def
c_headers
(
self
):
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
...
@@ -718,7 +718,7 @@ class GpuSoftmaxWithBias (GpuKernelBase, Op):
...
@@ -718,7 +718,7 @@ class GpuSoftmaxWithBias (GpuKernelBase, Op):
return
[
shape
[
0
]]
return
[
shape
[
0
]]
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
1
3
,)
+
inline_softmax
.
code_version
return
(
1
4
,)
+
inline_softmax
.
code_version
def
c_headers
(
self
):
def
c_headers
(
self
):
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
...
...
theano/sandbox/gpuarray/subtensor.py
浏览文件 @
0ad41ce5
...
@@ -394,7 +394,7 @@ class GpuIncSubtensor(GpuKernelBase, IncSubtensor):
...
@@ -394,7 +394,7 @@ class GpuIncSubtensor(GpuKernelBase, IncSubtensor):
elemwise_version
=
self
.
iadd_node
.
c_code_cache_version
()
elemwise_version
=
self
.
iadd_node
.
c_code_cache_version
()
if
not
parent_version
or
not
elemwise_version
:
if
not
parent_version
or
not
elemwise_version
:
return
return
return
parent_version
+
elemwise_version
+
(
2
,)
return
parent_version
+
elemwise_version
+
(
3
,)
class
GpuAdvancedSubtensor1
(
HideC
,
tensor
.
AdvancedSubtensor1
):
class
GpuAdvancedSubtensor1
(
HideC
,
tensor
.
AdvancedSubtensor1
):
...
...
theano/sandbox/gpuarray/type.py
浏览文件 @
0ad41ce5
...
@@ -202,10 +202,10 @@ class GpuArrayType(Type):
...
@@ -202,10 +202,10 @@ class GpuArrayType(Type):
def
convert_variable
(
self
,
var
):
def
convert_variable
(
self
,
var
):
vt
=
var
.
type
vt
=
var
.
type
if
(
type
(
self
)
==
type
(
vt
)
and
if
(
type
(
self
)
==
type
(
vt
)
and
self
.
typecode
==
v
ar
.
type
.
typecode
and
self
.
typecode
==
v
t
.
typecode
and
self
.
ndim
==
v
ar
.
type
.
ndim
and
self
.
ndim
==
v
t
.
ndim
and
all
(
sb
==
ob
or
ob
for
sb
,
ob
in
zip
(
self
.
broadcastable
,
all
(
sb
==
ob
or
ob
for
sb
,
ob
in
zip
(
self
.
broadcastable
,
v
ar
.
type
.
broadcastable
))):
v
t
.
broadcastable
))):
return
theano
.
tensor
.
patternbroadcast
(
var
,
self
.
broadcastable
)
return
theano
.
tensor
.
patternbroadcast
(
var
,
self
.
broadcastable
)
def
__hash__
(
self
):
def
__hash__
(
self
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论