Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3b57cbf3
提交
3b57cbf3
authored
9月 29, 2009
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
many modif to make test_conv.py:TestConvOp.test_ConvOpGrad run in 20m instead of 4h in debug mode.
上级
f9a67241
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
16 行增加
和
22 行删除
+16
-22
test_conv.py
theano/sandbox/test_conv.py
+16
-22
没有找到文件。
theano/sandbox/test_conv.py
浏览文件 @
3b57cbf3
...
@@ -434,13 +434,13 @@ class TestConvOp(unittest.TestCase):
...
@@ -434,13 +434,13 @@ class TestConvOp(unittest.TestCase):
print
' TEST ConvOp.grad'
print
' TEST ConvOp.grad'
print
'*************************************************'
print
'*************************************************'
nkern
=
4
nkern
=
3
bsize
=
3
bsize
=
2
types
=
[
"float32"
,
"float64"
]
types
=
[
"float32"
,
"float64"
]
kshps
=
[(
3
,
4
)]
kshps
=
[(
2
,
3
)]
imshps
=
[(
2
,
8
,
7
)]
imshps
=
[(
2
,
3
,
4
)]
modes
=
[
'valid'
,
'full'
]
modes
=
[
'valid'
,
'full'
]
unroll
=
[(
0
,
0
),(
1
,
1
),(
1
,
4
),(
3
,
1
),(
3
,
4
)]
unroll
=
[(
0
,
0
),(
1
,
1
),(
2
,
3
)]
ssizes
=
[(
1
,
1
),(
2
,
2
)]
ssizes
=
[(
1
,
1
),(
2
,
2
)]
for
typ
in
types
:
for
typ
in
types
:
...
@@ -449,18 +449,16 @@ class TestConvOp(unittest.TestCase):
...
@@ -449,18 +449,16 @@ class TestConvOp(unittest.TestCase):
for
mode
in
modes
:
for
mode
in
modes
:
for
imshp
in
imshps
:
for
imshp
in
imshps
:
visdim
=
1
if
len
(
imshp
)
!=
3
else
imshp
[
0
]
visdim
=
1
if
len
(
imshp
)
!=
3
else
imshp
[
0
]
imgvals
=
N
.
array
(
N
.
random
.
random
(
N
.
hstack
((
bsize
,
imshp
))),
dtype
=
imgs
.
dtype
)
for
kshp
in
kshps
:
for
kshp
in
kshps
:
t
=
numpy
.
array
([
imshp
[
1
]
-
kshp
[
0
],
imshp
[
2
]
-
kshp
[
1
]])
t
=
numpy
.
array
([
imshp
[
1
]
-
kshp
[
0
],
imshp
[
2
]
-
kshp
[
1
]])
kernvals
=
N
.
array
(
N
.
random
.
rand
(
nkern
,
visdim
,
kshp
[
0
],
kshp
[
1
]),
dtype
=
kerns
.
dtype
)
# 'full' mode should support kernels bigger than the input
# 'full' mode should support kernels bigger than the input
if
mode
==
'valid'
and
(
t
<
0
)
.
any
():
if
mode
==
'valid'
and
(
t
<
0
)
.
any
():
continue
continue
for
un_b
,
un_k
in
unroll
:
for
un_b
,
un_k
in
unroll
:
for
ss
in
ssizes
:
for
ss
in
ssizes
:
imgvals
=
N
.
array
(
N
.
random
.
random
(
N
.
hstack
((
bsize
,
imshp
))),
dtype
=
imgs
.
dtype
)
kernvals
=
N
.
array
(
N
.
random
.
rand
(
nkern
,
visdim
,
kshp
[
0
],
kshp
[
1
]),
dtype
=
kerns
.
dtype
)
print
'test_ConvOpGrad'
print
'test_ConvOpGrad'
print
'mode type:'
,
mode
,
typ
print
'mode type:'
,
mode
,
typ
print
'imshp:'
,
imshp
print
'imshp:'
,
imshp
...
@@ -472,19 +470,15 @@ class TestConvOp(unittest.TestCase):
...
@@ -472,19 +470,15 @@ class TestConvOp(unittest.TestCase):
print
'nkern:'
,
4
print
'nkern:'
,
4
def
test_i
(
imgs
):
def
test_i
(
imgs
):
out
,
outshp
=
convolve2
(
kernvals
,
kshp
,
nkern
,
convop
=
ConvOp
(
imshp
,
kshp
,
nkern
,
bsize
,
ss
[
0
],
ss
[
1
],
imgs
,
imshp
,
bsize
,
output_mode
=
mode
,
unroll_batch
=
un_b
,
unroll_kern
=
un_k
)
mode
=
mode
,
step
=
ss
,
return
convop
(
imgs
,
kernvals
)
unroll_batch
=
un_b
,
unroll_kern
=
un_k
)
return
out
def
test_k
(
kerns
):
def
test_k
(
kerns
):
out
,
outshp
=
convolve2
(
kerns
,
kshp
,
nkern
,
convop
=
ConvOp
(
imshp
,
kshp
,
nkern
,
bsize
,
ss
[
0
],
ss
[
1
],
imgvals
,
imshp
,
bsize
,
output_mode
=
mode
,
unroll_batch
=
un_b
,
unroll_kern
=
un_k
)
mode
=
mode
,
step
=
ss
,
return
convop
(
imgvals
,
kerns
)
unroll_batch
=
un_b
,
unroll_kern
=
un_k
)
return
out
#TODO the tolerance needed to pass is very high for float32(0.17). Is this acceptable? Expected?
#TODO the tolerance needed to pass is very high for float32(0.17). Is this acceptable? Expected?
utt
.
verify_grad
(
test_i
,
[
imgvals
],
utt
.
verify_grad
(
test_i
,
[
imgvals
],
cast_to_output_type
=
True
,
cast_to_output_type
=
True
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论