Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a3e94b40
提交
a3e94b40
authored
9月 24, 2015
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Test more cases, make sure unimplemented raise error
上级
62c86dcb
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
103 行增加
和
37 行删除
+103
-37
test_abstractconv.py
theano/tensor/nnet/tests/test_abstractconv.py
+103
-37
没有找到文件。
theano/tensor/nnet/tests/test_abstractconv.py
浏览文件 @
a3e94b40
...
@@ -194,77 +194,143 @@ class TestConv2d(unittest.TestCase):
...
@@ -194,77 +194,143 @@ class TestConv2d(unittest.TestCase):
if
not
dnn_available
():
if
not
dnn_available
():
return
return
mode
=
mode_with_gpu
mode
=
mode_with_gpu
# provide_shape is not used by the CuDNN impementation
inputs_shapes
=
self
.
inputs_shapes
provide_shape
=
False
filters_shapes
=
self
.
filters_shapes
subsamples
=
self
.
subsamples
for
(
i
,
f
),
s
,
b
,
flip
in
itertools
.
product
(
border_modes
=
self
.
border_modes
zip
(
self
.
inputs_shapes
,
self
.
filters_shapes
),
for
i
,
f
in
zip
(
inputs_shapes
[
0
:
1
],
filters_shapes
[
0
:
1
]):
self
.
subsamples
,
for
s
in
subsamples
:
self
.
border_modes
,
for
b
in
border_modes
:
self
.
filters_flip
)
:
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
)
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
)
for
provide_shape
in
[
False
,
True
]:
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'gpu'
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'gpu'
,
provide_shape
=
provide_shape
,
border_mode
=
b
)
provide_shape
=
provide_shape
,
border_mode
=
b
,
filters_flip
=
flip
)
self
.
run_gradweight
(
inputs_shape
=
i
,
filters_shape
=
f
,
self
.
run_gradweight
(
inputs_shape
=
i
,
filters_shape
=
f
,
output_shape
=
o
,
subsample
=
s
,
output_shape
=
o
,
subsample
=
s
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'gpu'
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'gpu'
,
provide_shape
=
provide_shape
,
border_mode
=
b
)
provide_shape
=
provide_shape
,
border_mode
=
b
,
filters_flip
=
flip
)
self
.
run_gradinput
(
inputs_shape
=
i
,
filters_shape
=
f
,
self
.
run_gradinput
(
inputs_shape
=
i
,
filters_shape
=
f
,
output_shape
=
o
,
subsample
=
s
,
output_shape
=
o
,
subsample
=
s
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'gpu'
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'gpu'
,
provide_shape
=
provide_shape
,
border_mode
=
b
)
provide_shape
=
provide_shape
,
border_mode
=
b
,
filters_flip
=
flip
)
def
test_cormm_conv
(
self
):
def
test_cormm_conv
(
self
):
mode
=
mode_with_gpu
.
excluding
(
'cudnn'
)
mode
=
mode_with_gpu
.
excluding
(
'cudnn'
)
inputs_shapes
=
self
.
inputs_shapes
for
(
i
,
f
),
s
,
b
,
flip
,
provide_shape
in
itertools
.
product
(
filters_shapes
=
self
.
filters_shapes
zip
(
self
.
inputs_shapes
,
self
.
filters_shapes
),
subsamples
=
self
.
subsamples
self
.
subsamples
,
border_modes
=
self
.
border_modes
self
.
border_modes
,
for
i
,
f
in
zip
(
inputs_shapes
,
filters_shapes
):
self
.
filters_flip
,
for
s
in
subsamples
:
[
False
,
True
])
:
for
b
in
border_modes
:
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
)
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
)
for
provide_shape
in
[
False
,
True
]:
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'gpu'
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'gpu'
,
provide_shape
=
provide_shape
,
border_mode
=
b
)
provide_shape
=
provide_shape
,
border_mode
=
b
,
filters_flip
=
flip
)
self
.
run_gradweight
(
inputs_shape
=
i
,
filters_shape
=
f
,
self
.
run_gradweight
(
inputs_shape
=
i
,
filters_shape
=
f
,
output_shape
=
o
,
subsample
=
s
,
output_shape
=
o
,
subsample
=
s
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'gpu'
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'gpu'
,
provide_shape
=
provide_shape
,
border_mode
=
b
)
provide_shape
=
provide_shape
,
border_mode
=
b
,
filters_flip
=
flip
)
self
.
run_gradinput
(
inputs_shape
=
i
,
filters_shape
=
f
,
self
.
run_gradinput
(
inputs_shape
=
i
,
filters_shape
=
f
,
output_shape
=
o
,
subsample
=
s
,
output_shape
=
o
,
subsample
=
s
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'gpu'
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'gpu'
,
provide_shape
=
provide_shape
,
border_mode
=
b
)
provide_shape
=
provide_shape
,
border_mode
=
b
,
filters_flip
=
flip
)
def
test_cpu_conv
(
self
):
mode
=
mode_without_gpu
for
(
i
,
f
),
s
,
b
,
flip
,
provide_shape
in
itertools
.
product
(
zip
(
self
.
inputs_shapes
,
self
.
filters_shapes
),
self
.
subsamples
,
self
.
border_modes
,
self
.
filters_flip
,
[
False
,
True
]):
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
)
fwd_OK
=
True
gradweight_OK
=
True
gradinput_OK
=
True
if
not
flip
:
fwd_OK
=
False
gradweight_OK
=
False
gradinput_OK
=
False
def
test_cpu_conv
(
self
):
if
b
not
in
(
'valid'
,
'full'
):
mode
=
mode_without_gpu
fwd_OK
=
False
gradweight_OK
=
False
gradinput_OK
=
False
inputs_shapes
=
self
.
inputs_shapes
if
(
not
provide_shape
)
and
(
s
!=
(
1
,
1
))
and
(
b
==
'full'
):
filters_shapes
=
self
.
filters_shapes
gradweight_OK
=
False
subsamples
=
self
.
subsamples
gradinput_OK
=
False
border_modes
=
self
.
border_modes
[:
2
]
# only valid and full are supported
for
i
,
f
in
zip
(
inputs_shapes
,
filters_shapes
):
if
((
s
[
0
]
not
in
(
1
,
2
))
or
(
s
[
1
]
not
in
(
1
,
2
)))
and
(
b
==
'full'
):
for
s
in
subsamples
:
gradweight_OK
=
False
for
b
in
border_modes
:
gradinput_OK
=
False
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
)
for
provide_shape
in
[
False
,
True
]
:
if
fwd_OK
:
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'cpu'
,
verify_grad
=
True
,
mode
=
mode
,
device
=
'cpu'
,
provide_shape
=
provide_shape
,
border_mode
=
b
)
provide_shape
=
provide_shape
,
border_mode
=
b
,
filters_flip
=
flip
)
else
:
self
.
assertRaises
(
NotImplementedError
,
self
.
run_fwd
,
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
verify_grad
=
False
,
mode
=
mode
,
device
=
'cpu'
,
provide_shape
=
provide_shape
,
border_mode
=
b
,
filters_flip
=
flip
)
if
gradweight_OK
:
self
.
run_gradweight
(
inputs_shape
=
i
,
filters_shape
=
f
,
self
.
run_gradweight
(
inputs_shape
=
i
,
filters_shape
=
f
,
output_shape
=
o
,
subsample
=
s
,
output_shape
=
o
,
subsample
=
s
,
verify_grad
=
False
,
mode
=
mode
,
device
=
'cpu'
,
verify_grad
=
False
,
mode
=
mode
,
device
=
'cpu'
,
provide_shape
=
provide_shape
,
border_mode
=
b
)
provide_shape
=
provide_shape
,
border_mode
=
b
,
filters_flip
=
flip
)
else
:
self
.
assertRaises
(
NotImplementedError
,
self
.
run_gradweight
,
inputs_shape
=
i
,
filters_shape
=
f
,
output_shape
=
o
,
subsample
=
s
,
verify_grad
=
False
,
mode
=
mode
,
device
=
'cpu'
,
provide_shape
=
provide_shape
,
border_mode
=
b
,
filters_flip
=
flip
)
if
gradinput_OK
:
self
.
run_gradinput
(
inputs_shape
=
i
,
filters_shape
=
f
,
self
.
run_gradinput
(
inputs_shape
=
i
,
filters_shape
=
f
,
output_shape
=
o
,
subsample
=
s
,
output_shape
=
o
,
subsample
=
s
,
verify_grad
=
False
,
mode
=
mode
,
device
=
'cpu'
,
verify_grad
=
False
,
mode
=
mode
,
device
=
'cpu'
,
provide_shape
=
provide_shape
,
border_mode
=
b
)
provide_shape
=
provide_shape
,
border_mode
=
b
,
filters_flip
=
flip
)
else
:
self
.
assertRaises
(
NotImplementedError
,
self
.
run_gradinput
,
inputs_shape
=
i
,
filters_shape
=
f
,
output_shape
=
o
,
subsample
=
s
,
verify_grad
=
False
,
mode
=
mode
,
device
=
'cpu'
,
provide_shape
=
provide_shape
,
border_mode
=
b
,
filters_flip
=
flip
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论