Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ebab0a06
提交
ebab0a06
authored
6月 09, 2017
作者:
affanv14
提交者:
Mohammed Affan
6月 14, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change variable names in tests
上级
f8955c9e
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
40 行增加
和
40 行删除
+40
-40
test_abstract_conv.py
theano/tensor/nnet/tests/test_abstract_conv.py
+40
-40
没有找到文件。
theano/tensor/nnet/tests/test_abstract_conv.py
浏览文件 @
ebab0a06
...
...
@@ -1727,23 +1727,23 @@ class Grouped_conv_noOptim(unittest.TestCase):
img_sym
=
theano
.
tensor
.
tensor4
(
'img'
)
kern_sym
=
theano
.
tensor
.
tensor4
(
'kern'
)
grouped_abstractconv_
func
=
self
.
conv2d
(
border_mode
=
self
.
border_mode
,
subsample
=
self
.
subsample
,
filter_dilation
=
self
.
filter_dilation
,
num_groups
=
groups
)
grouped_abstractconv_
op
=
self
.
conv2d
(
border_mode
=
self
.
border_mode
,
subsample
=
self
.
subsample
,
filter_dilation
=
self
.
filter_dilation
,
num_groups
=
groups
)
if
self
.
flip_filter
:
grouped_conv_output
=
grouped_abstractconv_
func
(
img_sym
,
kern_sym
[:,
:,
::
-
1
,
::
-
1
])
grouped_conv_output
=
grouped_abstractconv_
op
(
img_sym
,
kern_sym
[:,
:,
::
-
1
,
::
-
1
])
else
:
grouped_conv_output
=
grouped_abstractconv_
func
(
img_sym
,
kern_sym
)
grouped_conv_output
=
grouped_abstractconv_
op
(
img_sym
,
kern_sym
)
grouped_func
=
theano
.
function
([
img_sym
,
kern_sym
],
grouped_conv_output
,
mode
=
self
.
mode
)
grouped_output
=
grouped_func
(
img
,
kern
)
normal_conv_o
utput
=
conv2d_corr
(
img_sym
,
kern_sym
,
border_mode
=
self
.
border_mode
,
subsample
=
self
.
subsample
,
filter_dilation
=
self
.
filter_dilation
)
normal_func
=
theano
.
function
([
img_sym
,
kern_sym
],
normal_conv_o
utput
,
normal_conv_o
p
=
conv2d_corr
(
img_sym
,
kern_sym
,
border_mode
=
self
.
border_mode
,
subsample
=
self
.
subsample
,
filter_dilation
=
self
.
filter_dilation
)
normal_func
=
theano
.
function
([
img_sym
,
kern_sym
],
normal_conv_o
p
,
mode
=
self
.
ref_mode
)
normal_concat_output
=
[
normal_func
(
img_arr
,
kern_arr
)
for
img_arr
,
kern_arr
in
zip
(
split_imgs
,
split_kern
)]
...
...
@@ -1751,7 +1751,7 @@ class Grouped_conv_noOptim(unittest.TestCase):
utt
.
assert_allclose
(
grouped_output
,
normal_concat_output
)
utt
.
verify_grad
(
grouped_abstractconv_
func
,
utt
.
verify_grad
(
grouped_abstractconv_
op
,
[
img
,
kern
],
mode
=
self
.
mode
)
...
...
@@ -1764,23 +1764,23 @@ class Grouped_conv_noOptim(unittest.TestCase):
img_sym
=
theano
.
tensor
.
tensor4
(
'img'
)
top_sym
=
theano
.
tensor
.
tensor4
(
'top'
)
grouped_abstractconvgrad_
func
=
self
.
conv2d_gradw
(
border_mode
=
self
.
border_mode
,
subsample
=
self
.
subsample
,
filter_dilation
=
self
.
filter_dilation
,
num_groups
=
groups
)
grouped_conv_output
=
grouped_abstractconvgrad_
func
(
img_sym
,
top_sym
,
kshp
[
-
2
:])
grouped_abstractconvgrad_
op
=
self
.
conv2d_gradw
(
border_mode
=
self
.
border_mode
,
subsample
=
self
.
subsample
,
filter_dilation
=
self
.
filter_dilation
,
num_groups
=
groups
)
grouped_conv_output
=
grouped_abstractconvgrad_
op
(
img_sym
,
top_sym
,
kshp
[
-
2
:])
if
self
.
flip_filter
:
grouped_conv_output
=
grouped_conv_output
[:,
:,
::
-
1
,
::
-
1
]
grouped_func
=
theano
.
function
([
img_sym
,
top_sym
],
grouped_conv_output
,
mode
=
self
.
mode
)
grouped_output
=
grouped_func
(
img
,
top
)
normal_conv_o
utput
=
conv2d_corr_gw
(
img_sym
,
top_sym
,
kshp
,
border_mode
=
self
.
border_mode
,
subsample
=
self
.
subsample
,
filter_dilation
=
self
.
filter_dilation
)
normal_func
=
theano
.
function
([
img_sym
,
top_sym
],
normal_conv_o
utput
,
normal_conv_o
p
=
conv2d_corr_gw
(
img_sym
,
top_sym
,
kshp
,
border_mode
=
self
.
border_mode
,
subsample
=
self
.
subsample
,
filter_dilation
=
self
.
filter_dilation
)
normal_func
=
theano
.
function
([
img_sym
,
top_sym
],
normal_conv_o
p
,
mode
=
self
.
ref_mode
)
normal_concat_output
=
[
normal_func
(
img_arr
,
top_arr
)
for
img_arr
,
top_arr
in
zip
(
split_imgs
,
split_top
)]
...
...
@@ -1789,7 +1789,7 @@ class Grouped_conv_noOptim(unittest.TestCase):
utt
.
assert_allclose
(
grouped_output
,
normal_concat_output
)
def
abstract_conv_gradweight
(
inputs_val
,
output_val
):
return
grouped_abstractconvgrad_
func
(
inputs_val
,
output_val
,
kshp
[
-
2
:])
return
grouped_abstractconvgrad_
op
(
inputs_val
,
output_val
,
kshp
[
-
2
:])
utt
.
verify_grad
(
abstract_conv_gradweight
,
[
img
,
top
],
...
...
@@ -1805,24 +1805,24 @@ class Grouped_conv_noOptim(unittest.TestCase):
kern_sym
=
theano
.
tensor
.
tensor4
(
'kern'
)
top_sym
=
theano
.
tensor
.
tensor4
(
'top'
)
grouped_abstractconvgrad_
func
=
self
.
conv2d_gradi
(
border_mode
=
self
.
border_mode
,
subsample
=
self
.
subsample
,
filter_dilation
=
self
.
filter_dilation
,
num_groups
=
groups
)
grouped_abstractconvgrad_
op
=
self
.
conv2d_gradi
(
border_mode
=
self
.
border_mode
,
subsample
=
self
.
subsample
,
filter_dilation
=
self
.
filter_dilation
,
num_groups
=
groups
)
if
self
.
flip_filter
:
grouped_conv_output
=
grouped_abstractconvgrad_
func
(
kern_sym
[:,
:,
::
-
1
,
::
-
1
],
top_sym
,
imshp
[
-
2
:])
grouped_conv_output
=
grouped_abstractconvgrad_
op
(
kern_sym
[:,
:,
::
-
1
,
::
-
1
],
top_sym
,
imshp
[
-
2
:])
else
:
grouped_conv_output
=
grouped_abstractconvgrad_
func
(
kern_sym
,
top_sym
,
imshp
[
-
2
:])
grouped_conv_output
=
grouped_abstractconvgrad_
op
(
kern_sym
,
top_sym
,
imshp
[
-
2
:])
grouped_func
=
theano
.
function
([
kern_sym
,
top_sym
],
grouped_conv_output
,
mode
=
self
.
mode
)
grouped_output
=
grouped_func
(
kern
,
top
)
normal_conv_o
utput
=
conv2d_corr_gi
(
kern_sym
,
top_sym
,
imshp
,
border_mode
=
self
.
border_mode
,
subsample
=
self
.
subsample
,
filter_dilation
=
self
.
filter_dilation
)
normal_func
=
theano
.
function
([
kern_sym
,
top_sym
],
normal_conv_o
utput
,
normal_conv_o
p
=
conv2d_corr_gi
(
kern_sym
,
top_sym
,
imshp
,
border_mode
=
self
.
border_mode
,
subsample
=
self
.
subsample
,
filter_dilation
=
self
.
filter_dilation
)
normal_func
=
theano
.
function
([
kern_sym
,
top_sym
],
normal_conv_o
p
,
mode
=
self
.
ref_mode
)
normal_concat_output
=
[
normal_func
(
kern_arr
,
top_arr
)
for
kern_arr
,
top_arr
in
zip
(
split_kerns
,
split_top
)]
...
...
@@ -1831,7 +1831,7 @@ class Grouped_conv_noOptim(unittest.TestCase):
utt
.
assert_allclose
(
grouped_output
,
normal_concat_output
)
def
abstract_conv_gradinputs
(
filters_val
,
output_val
):
return
grouped_abstractconvgrad_
func
(
filters_val
,
output_val
,
imshp
[
2
:])
return
grouped_abstractconvgrad_
op
(
filters_val
,
output_val
,
imshp
[
2
:])
utt
.
verify_grad
(
abstract_conv_gradinputs
,
[
kern
,
top
],
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论