Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ef78ecbc
提交
ef78ecbc
authored
8月 22, 2016
作者:
Frédéric Bastien
提交者:
GitHub
8月 22, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4874 from gvtulder/f-abstractconv-dilationtest
Fix abstractconv_grad dilation and enable border_mode tests
上级
35e54bb7
e1ae89f5
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
10 行删除
+12
-10
abstract_conv.py
theano/tensor/nnet/abstract_conv.py
+7
-8
test_abstract_conv.py
theano/tensor/nnet/tests/test_abstract_conv.py
+5
-2
没有找到文件。
theano/tensor/nnet/abstract_conv.py
浏览文件 @
ef78ecbc
...
@@ -966,14 +966,15 @@ class AbstractConv2d_gradWeights(BaseAbstractConv2d):
...
@@ -966,14 +966,15 @@ class AbstractConv2d_gradWeights(BaseAbstractConv2d):
'"valid", "full", "half", an integer or a pair of'
'"valid", "full", "half", an integer or a pair of'
' integers'
.
format
(
mode
))
' integers'
.
format
(
mode
))
dil_shape
=
((
shape
[
0
]
-
1
)
*
self
.
filter_dilation
[
0
]
+
1
,
(
shape
[
1
]
-
1
)
*
self
.
filter_dilation
[
1
]
+
1
)
if
mode
==
"full"
:
if
mode
==
"full"
:
mode
=
(
shape
[
0
]
-
1
,
shape
[
1
]
-
1
)
mode
=
(
dil_shape
[
0
]
-
1
,
dil_
shape
[
1
]
-
1
)
elif
mode
==
"half"
:
elif
mode
==
"half"
:
mode
=
(
shape
[
0
]
//
2
,
shape
[
1
]
//
2
)
mode
=
(
dil_shape
[
0
]
//
2
,
dil_
shape
[
1
]
//
2
)
if
isinstance
(
mode
,
tuple
):
if
isinstance
(
mode
,
tuple
):
pad_h
,
pad_w
=
map
(
int
,
mode
)
pad_h
,
pad_w
=
map
(
int
,
mode
)
pad_h
=
(
pad_h
-
1
)
*
self
.
filter_dilation
[
0
]
+
1
pad_w
=
(
pad_w
-
1
)
*
self
.
filter_dilation
[
1
]
+
1
mode
=
"valid"
mode
=
"valid"
new_img
=
numpy
.
zeros
((
img
.
shape
[
0
],
img
.
shape
[
1
],
new_img
=
numpy
.
zeros
((
img
.
shape
[
0
],
img
.
shape
[
1
],
...
@@ -983,8 +984,6 @@ class AbstractConv2d_gradWeights(BaseAbstractConv2d):
...
@@ -983,8 +984,6 @@ class AbstractConv2d_gradWeights(BaseAbstractConv2d):
img
=
new_img
img
=
new_img
if
self
.
subsample
[
0
]
>
1
or
self
.
subsample
[
1
]
>
1
:
if
self
.
subsample
[
0
]
>
1
or
self
.
subsample
[
1
]
>
1
:
dil_shape
=
((
shape
[
0
]
-
1
)
*
self
.
filter_dilation
[
0
]
+
1
,
(
shape
[
1
]
-
1
)
*
self
.
filter_dilation
[
1
]
+
1
)
new_shape
=
(
topgrad
.
shape
[
0
],
topgrad
.
shape
[
1
],
new_shape
=
(
topgrad
.
shape
[
0
],
topgrad
.
shape
[
1
],
img
.
shape
[
2
]
-
dil_shape
[
0
]
+
1
,
img
.
shape
[
2
]
-
dil_shape
[
0
]
+
1
,
img
.
shape
[
3
]
-
dil_shape
[
1
]
+
1
)
img
.
shape
[
3
]
-
dil_shape
[
1
]
+
1
)
...
@@ -1114,9 +1113,9 @@ class AbstractConv2d_gradInputs(BaseAbstractConv2d):
...
@@ -1114,9 +1113,9 @@ class AbstractConv2d_gradInputs(BaseAbstractConv2d):
(
kern
.
shape
[
3
]
-
1
)
*
self
.
filter_dilation
[
1
]
+
1
)
(
kern
.
shape
[
3
]
-
1
)
*
self
.
filter_dilation
[
1
]
+
1
)
pad_h
,
pad_w
=
0
,
0
pad_h
,
pad_w
=
0
,
0
if
mode
==
"full"
:
if
mode
==
"full"
:
pad_h
,
pad_w
=
(
dil_kernshp
[
0
]
-
1
,
dil_kernshp
[
0
]
-
1
)
pad_h
,
pad_w
=
(
dil_kernshp
[
0
]
-
1
,
dil_kernshp
[
1
]
-
1
)
elif
mode
==
"half"
:
elif
mode
==
"half"
:
pad_h
,
pad_w
=
(
dil_kernshp
[
1
]
//
2
,
dil_kernshp
[
1
]
//
2
)
pad_h
,
pad_w
=
(
dil_kernshp
[
0
]
//
2
,
dil_kernshp
[
1
]
//
2
)
elif
isinstance
(
mode
,
tuple
):
elif
isinstance
(
mode
,
tuple
):
pad_h
,
pad_w
=
map
(
int
,
self
.
border_mode
)
pad_h
,
pad_w
=
map
(
int
,
self
.
border_mode
)
if
self
.
subsample
[
0
]
>
1
or
self
.
subsample
[
1
]
>
1
:
if
self
.
subsample
[
0
]
>
1
or
self
.
subsample
[
1
]
>
1
:
...
...
theano/tensor/nnet/tests/test_abstract_conv.py
浏览文件 @
ef78ecbc
...
@@ -89,7 +89,7 @@ class BaseTestConv2d:
...
@@ -89,7 +89,7 @@ class BaseTestConv2d:
(
1
,
1
,
2
,
3
),
(
4
,
1
,
1
,
3
),
(
4
,
5
,
3
,
2
)]
(
1
,
1
,
2
,
3
),
(
4
,
1
,
1
,
3
),
(
4
,
5
,
3
,
2
)]
cls
.
subsamples
=
[(
1
,
1
),
(
2
,
2
),
(
2
,
4
)]
cls
.
subsamples
=
[(
1
,
1
),
(
2
,
2
),
(
2
,
4
)]
cls
.
filters_dilations
=
[(
1
,
1
),
(
1
,
2
),
(
2
,
1
)]
cls
.
filters_dilations
=
[(
1
,
1
),
(
1
,
2
),
(
2
,
1
)]
cls
.
border_modes
=
[
"valid"
,
"full"
,
(
0
,
0
),
(
1
,
1
),
(
5
,
5
),
(
5
,
2
)]
cls
.
border_modes
=
[
"valid"
,
"
half"
,
"
full"
,
(
0
,
0
),
(
1
,
1
),
(
5
,
5
),
(
5
,
2
)]
cls
.
filter_flip
=
[
True
,
False
]
cls
.
filter_flip
=
[
True
,
False
]
cls
.
provide_shape
=
[
True
,
False
]
cls
.
provide_shape
=
[
True
,
False
]
cls
.
shared
=
staticmethod
(
theano
.
compile
.
shared
)
cls
.
shared
=
staticmethod
(
theano
.
compile
.
shared
)
...
@@ -100,6 +100,9 @@ class BaseTestConv2d:
...
@@ -100,6 +100,9 @@ class BaseTestConv2d:
(
filters_shape
[
3
]
-
1
)
*
filter_dilation
[
1
]
+
1
)
(
filters_shape
[
3
]
-
1
)
*
filter_dilation
[
1
]
+
1
)
if
border_mode
==
"valid"
:
if
border_mode
==
"valid"
:
border_mode
=
(
0
,
0
)
border_mode
=
(
0
,
0
)
if
border_mode
==
"half"
:
border_mode
=
(
dil_filters
[
0
]
//
2
,
dil_filters
[
1
]
//
2
)
if
border_mode
==
"full"
:
if
border_mode
==
"full"
:
border_mode
=
(
dil_filters
[
0
]
-
1
,
border_mode
=
(
dil_filters
[
0
]
-
1
,
dil_filters
[
1
]
-
1
)
dil_filters
[
1
]
-
1
)
...
@@ -292,7 +295,7 @@ class BaseTestConv2d:
...
@@ -292,7 +295,7 @@ class BaseTestConv2d:
for
fd
in
self
.
filters_dilations
:
for
fd
in
self
.
filters_dilations
:
for
s
in
self
.
subsamples
:
for
s
in
self
.
subsamples
:
for
b
in
self
.
border_modes
:
for
b
in
self
.
border_modes
:
yield
(
self
.
tcase
,
i
,
f
,
s
,
d
b
,
dflip
,
yield
(
self
.
tcase
,
i
,
f
,
s
,
b
,
dflip
,
dprovide_shape
,
fd
)
dprovide_shape
,
fd
)
for
flip
in
self
.
filter_flip
:
for
flip
in
self
.
filter_flip
:
yield
(
self
.
tcase
,
i
,
f
,
ds
,
db
,
flip
,
dprovide_shape
)
yield
(
self
.
tcase
,
i
,
f
,
ds
,
db
,
flip
,
dprovide_shape
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论