Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d6a9018a
提交
d6a9018a
authored
8月 26, 2017
作者:
Vikram
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Same changes for GPU. cuDNN disabled. More tests
上级
5726f9ab
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
29 行增加
和
7 行删除
+29
-7
blas.py
theano/gpuarray/blas.py
+5
-5
dnn.py
theano/gpuarray/dnn.py
+11
-0
test_gemmcorr.py
theano/gpuarray/tests/test_gemmcorr.py
+5
-1
test_abstract_conv.py
theano/tensor/nnet/tests/test_abstract_conv.py
+0
-0
test_corr.py
theano/tensor/nnet/tests/test_corr.py
+8
-1
没有找到文件。
theano/gpuarray/blas.py
浏览文件 @
d6a9018a
...
@@ -480,11 +480,11 @@ class BaseGpuCorrMM(CGpuKernelBase):
...
@@ -480,11 +480,11 @@ class BaseGpuCorrMM(CGpuKernelBase):
'tuple of length 2'
.
format
(
border_mode
))
'tuple of length 2'
.
format
(
border_mode
))
border
=
()
border
=
()
for
mode
in
border_mode
:
for
mode
in
border_mode
:
if
isinstance
(
mode
,
integer_types
)
and
mode
>=
0
:
if
isinstance
(
mode
,
tuple
)
and
len
(
mode
)
==
2
and
\
border
+=
((
mode
,
mode
),)
elif
isinstance
(
mode
,
tuple
)
and
len
(
mode
)
==
2
and
\
min
(
mode
)
>=
0
:
min
(
mode
)
>=
0
:
border
+=
((
int
(
mode
[
0
]),
int
(
mode
[
1
])),)
border
+=
((
int
(
mode
[
0
]),
int
(
mode
[
1
])),)
elif
mode
>=
0
:
border
+=
((
int
(
mode
),
int
(
mode
)),)
else
:
else
:
raise
ValueError
(
raise
ValueError
(
'invalid border mode {}. The tuple can only contain '
'invalid border mode {}. The tuple can only contain '
...
@@ -630,13 +630,13 @@ class BaseGpuCorrMM(CGpuKernelBase):
...
@@ -630,13 +630,13 @@ class BaseGpuCorrMM(CGpuKernelBase):
if
height
:
if
height
:
height
=
'(*(npy_int*)(PyArray_DATA(
%
s)))'
%
height
height
=
'(*(npy_int*)(PyArray_DATA(
%
s)))'
%
height
else
:
else
:
if
((
direction
!=
0
)
and
(
dH
!=
1
))
or
((
direction
==
1
)
and
(
padH_l
==
-
1
)):
if
((
direction
!=
0
)
and
(
dH
!=
1
))
or
((
direction
==
1
)
and
(
padH_l
==
-
1
or
padH_r
==
-
1
)):
raise
ValueError
(
"height must be given for backprop with vertical sampling or pad='half'"
)
raise
ValueError
(
"height must be given for backprop with vertical sampling or pad='half'"
)
height
=
'-1'
height
=
'-1'
if
width
:
if
width
:
width
=
'(*(npy_int*)(PyArray_DATA(
%
s)))'
%
width
width
=
'(*(npy_int*)(PyArray_DATA(
%
s)))'
%
width
else
:
else
:
if
((
direction
!=
0
)
and
(
dW
!=
1
))
or
((
direction
==
1
)
and
(
padW_l
==
-
1
)):
if
((
direction
!=
0
)
and
(
dW
!=
1
))
or
((
direction
==
1
)
and
(
padW_l
==
-
1
or
padW_r
==
-
1
)):
raise
ValueError
(
"width must be given for backprop with horizontal sampling or pad='half'"
)
raise
ValueError
(
"width must be given for backprop with horizontal sampling or pad='half'"
)
width
=
'-1'
width
=
'-1'
...
...
theano/gpuarray/dnn.py
浏览文件 @
d6a9018a
...
@@ -3038,6 +3038,9 @@ def local_abstractconv_cudnn_graph(op, context_name, inputs, outputs):
...
@@ -3038,6 +3038,9 @@ def local_abstractconv_cudnn_graph(op, context_name, inputs, outputs):
if
op
.
unshared
:
if
op
.
unshared
:
return
None
return
None
if
isinstance
(
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
op
.
border_mode
):
return
None
inp1
=
inputs
[
0
]
inp1
=
inputs
[
0
]
inp2
=
inputs
[
1
]
inp2
=
inputs
[
1
]
...
@@ -3134,6 +3137,8 @@ def local_abstractconv_cudnn(node):
...
@@ -3134,6 +3137,8 @@ def local_abstractconv_cudnn(node):
return
return
if
node
.
op
.
unshared
:
if
node
.
op
.
unshared
:
return
None
return
None
if
isinstance
(
node
.
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
node
.
op
.
border_mode
):
return
None
if
isinstance
(
node
.
op
,
AbstractConv2d
):
if
isinstance
(
node
.
op
,
AbstractConv2d
):
return
local_abstractconv_cudnn_graph
(
node
.
op
,
ctx
,
node
.
inputs
,
node
.
outputs
)
return
local_abstractconv_cudnn_graph
(
node
.
op
,
ctx
,
node
.
inputs
,
node
.
outputs
)
elif
isinstance
(
node
.
op
,
AbstractConv3d
):
elif
isinstance
(
node
.
op
,
AbstractConv3d
):
...
@@ -3150,6 +3155,8 @@ def local_abstractconv_cudnn_alt(node):
...
@@ -3150,6 +3155,8 @@ def local_abstractconv_cudnn_alt(node):
return
None
return
None
if
node
.
op
.
unshared
:
if
node
.
op
.
unshared
:
return
None
return
None
if
isinstance
(
node
.
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
node
.
op
.
border_mode
):
return
None
inp1
=
node
.
inputs
[
0
]
inp1
=
node
.
inputs
[
0
]
inp2
=
node
.
inputs
[
1
]
inp2
=
node
.
inputs
[
1
]
...
@@ -3358,6 +3365,8 @@ def local_abstractconv_gw_cudnn(node):
...
@@ -3358,6 +3365,8 @@ def local_abstractconv_gw_cudnn(node):
return
return
if
node
.
op
.
unshared
:
if
node
.
op
.
unshared
:
return
None
return
None
if
isinstance
(
node
.
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
node
.
op
.
border_mode
):
return
None
if
isinstance
(
node
.
op
,
AbstractConv2d_gradWeights
):
if
isinstance
(
node
.
op
,
AbstractConv2d_gradWeights
):
return
local_abstractconv_cudnn_graph
(
node
.
op
,
ctx
,
node
.
inputs
,
node
.
outputs
)
return
local_abstractconv_cudnn_graph
(
node
.
op
,
ctx
,
node
.
inputs
,
node
.
outputs
)
elif
isinstance
(
node
.
op
,
AbstractConv3d_gradWeights
):
elif
isinstance
(
node
.
op
,
AbstractConv3d_gradWeights
):
...
@@ -3371,6 +3380,8 @@ def local_abstractconv_gi_cudnn(node):
...
@@ -3371,6 +3380,8 @@ def local_abstractconv_gi_cudnn(node):
return
return
if
node
.
op
.
unshared
:
if
node
.
op
.
unshared
:
return
None
return
None
if
isinstance
(
node
.
op
.
border_mode
,
tuple
)
and
any
(
isinstance
(
p
,
tuple
)
for
p
in
node
.
op
.
border_mode
):
return
None
if
isinstance
(
node
.
op
,
AbstractConv2d_gradInputs
):
if
isinstance
(
node
.
op
,
AbstractConv2d_gradInputs
):
return
local_abstractconv_cudnn_graph
(
node
.
op
,
ctx
,
node
.
inputs
,
node
.
outputs
)
return
local_abstractconv_cudnn_graph
(
node
.
op
,
ctx
,
node
.
inputs
,
node
.
outputs
)
elif
isinstance
(
node
.
op
,
AbstractConv3d_gradInputs
):
elif
isinstance
(
node
.
op
,
AbstractConv3d_gradInputs
):
...
...
theano/gpuarray/tests/test_gemmcorr.py
浏览文件 @
d6a9018a
...
@@ -12,7 +12,7 @@ from ..type import gpuarray_shared_constructor
...
@@ -12,7 +12,7 @@ from ..type import gpuarray_shared_constructor
from
..blas
import
GpuCorrMM
,
GpuCorrMM_gradWeights
,
GpuCorrMM_gradInputs
from
..blas
import
GpuCorrMM
,
GpuCorrMM_gradWeights
,
GpuCorrMM_gradInputs
from
.config
import
mode_with_gpu
,
mode_without_gpu
,
ref_cast
from
.config
import
mode_with_gpu
,
mode_without_gpu
,
ref_cast
from
theano.tensor.nnet.tests.test_abstract_conv
import
Grouped_conv_noOptim
,
TestUnsharedConv
from
theano.tensor.nnet.tests.test_abstract_conv
import
Grouped_conv_noOptim
,
TestUnsharedConv
from
theano.tensor.nnet.tests.test_abstract_conv
import
TestAsymmetricPadding
from
theano.tensor.nnet.tests.test_abstract_conv
import
TestAsymmetricPadding
,
TestCausalConv
class
TestCorrMM
(
unittest
.
TestCase
):
class
TestCorrMM
(
unittest
.
TestCase
):
...
@@ -280,3 +280,7 @@ class TestAsymmetricGpu(TestAsymmetricPadding):
...
@@ -280,3 +280,7 @@ class TestAsymmetricGpu(TestAsymmetricPadding):
conv2d_op
=
GpuCorrMM
conv2d_op
=
GpuCorrMM
conv2d_gradw_op
=
GpuCorrMM_gradWeights
conv2d_gradw_op
=
GpuCorrMM_gradWeights
conv2d_gradi_op
=
GpuCorrMM_gradInputs
conv2d_gradi_op
=
GpuCorrMM_gradInputs
class
TestCausalGpuCorr
(
TestCausalConv
):
mode
=
mode_with_gpu
.
excluding
(
'cudnn'
)
theano/tensor/nnet/tests/test_abstract_conv.py
浏览文件 @
d6a9018a
差异被折叠。
点击展开。
theano/tensor/nnet/tests/test_corr.py
浏览文件 @
d6a9018a
...
@@ -11,7 +11,7 @@ import theano.tensor as T
...
@@ -11,7 +11,7 @@ import theano.tensor as T
from
theano.tests
import
unittest_tools
as
utt
from
theano.tests
import
unittest_tools
as
utt
from
theano.tensor.nnet
import
corr
,
conv
from
theano.tensor.nnet
import
corr
,
conv
from
theano.tensor.nnet.tests.test_abstract_conv
import
Grouped_conv_noOptim
,
TestUnsharedConv
from
theano.tensor.nnet.tests.test_abstract_conv
import
Grouped_conv_noOptim
,
TestUnsharedConv
from
theano.tensor.nnet.tests.test_abstract_conv
import
TestAsymmetricPadding
from
theano.tensor.nnet.tests.test_abstract_conv
import
TestAsymmetricPadding
,
TestCausalConv
class
TestCorr2D
(
utt
.
InferShapeTester
):
class
TestCorr2D
(
utt
.
InferShapeTester
):
...
@@ -473,6 +473,13 @@ class TestAsymmetricCorr(TestAsymmetricPadding):
...
@@ -473,6 +473,13 @@ class TestAsymmetricCorr(TestAsymmetricPadding):
conv2d_gradi_op
=
corr
.
CorrMM_gradInputs
conv2d_gradi_op
=
corr
.
CorrMM_gradInputs
class
TestCausalCorr
(
TestCausalConv
):
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
mode
=
theano
.
compile
.
get_mode
(
"FAST_RUN"
)
.
excluding
(
'gpuarray'
)
else
:
mode
=
None
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
t
=
TestCorr2D
(
'setUp'
)
t
=
TestCorr2D
(
'setUp'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论