Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1b5c9a71
提交
1b5c9a71
authored
8月 14, 2009
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix test_conv_nnet2 as it had all y value to 0! Lowered the tolerance caused by…
Fix test_conv_nnet2 as it had all y value to 0! Lowered the tolerance caused by cumulatif rounding error.
上级
62aeb54d
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
20 行增加
和
6 行删除
+20
-6
test_nnet.py
tests/test_nnet.py
+20
-6
没有找到文件。
tests/test_nnet.py
浏览文件 @
1b5c9a71
...
...
@@ -134,15 +134,30 @@ def test_conv_nnet1():
def
run_conv_nnet2
(
shared_fn
):
# pretend we are training LeNet for MNIST
#cumulativ rounding error affect this comparaison of result. So we lower the tolerance.
#TODO: why the last two example see the error lower? We are converging?
#n_train=10, n_batch=3, n_kern=1, n_kern1=1, error see of 1e-9
#n_train=10, n_batch=3, n_kern=10, n_kern1=1, error see of -1.27777e-06
#n_train=10, n_batch=3, n_kern=10, n_kern1=10, error see of -6.91377e-05
#n_train=10, n_batch=30, n_kern=10, n_kern1=10, error see of -0.00185963
#n_train=10, n_batch=60, n_kern=10, n_kern1=10, error see of -5.26905e-05
#n_train=30, n_batch=60, n_kern=10, n_kern1=10, error see of -3.8147e-06
#n_train=30, n_batch=60, n_kern=20, n_kern1=10, error see of 6.82771e-05
#n_train=30, n_batch=60, n_kern=20, n_kern1=30, error see of 0.000231534
n_batch
=
60
shape_img
=
(
n_batch
,
1
,
32
,
32
)
n_kern
=
20
shape_kern
=
(
n_kern
,
1
,
5
,
5
)
n_kern1
=
3
0
n_kern1
=
1
0
shape_kern1
=
(
n_kern1
,
n_kern
,
5
,
5
)
n_train
=
30
logical_hid_shape
=
tcn
.
blas
.
GpuConv
.
logical_output_shape_2d
((
32
,
32
),
(
5
,
5
),
'valid'
)
logical_hid_shape1
=
tcn
.
blas
.
GpuConv
.
logical_output_shape_2d
((
logical_hid_shape
[
0
]
/
2
,
logical_hid_shape
[
1
]
/
2
),
(
5
,
5
),
'valid'
)
n_hid
=
n_kern1
*
logical_hid_shape1
[
0
]
*
logical_hid_shape1
[
1
]
...
...
@@ -181,10 +196,9 @@ def run_conv_nnet2(shared_fn): # pretend we are training LeNet for MNIST
print
i
,
n
xval
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape_img
),
dtype
=
'float32'
)
yval
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
n_batch
,
n_out
),
dtype
=
'
int32'
)
yval
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
n_batch
,
n_out
),
dtype
=
'
float32'
)
#int32 make all 0...
lr
=
numpy
.
asarray
(
0.01
,
dtype
=
'float32'
)
for
i
in
xrange
(
10
):
for
i
in
xrange
(
n_train
):
rval
=
train
(
xval
,
yval
,
lr
)
print_mode
(
mode
)
...
...
@@ -195,7 +209,7 @@ def test_conv_nnet2():
rval_cpu
=
run_conv_nnet2
(
shared
)
numpy
.
random
.
seed
(
23456
)
rval_gpu
=
run_conv_nnet2
(
tcn
.
shared_constructor
)
assert
numpy
.
allclose
(
rval_cpu
,
rval_gpu
,
rtol
=
1e-4
,
atol
=
1e-
6
)
assert
numpy
.
allclose
(
rval_cpu
,
rval_gpu
,
rtol
=
1e-4
,
atol
=
1e-
4
)
def
run_conv_nnet2_classif
(
shared_fn
):
# pretend we are training LeNet for MNIST
...
...
@@ -246,7 +260,7 @@ def run_conv_nnet2_classif(shared_fn): # pretend we are training LeNet for MNIST
print
i
,
n
xval
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape_img
),
dtype
=
'float32'
)
yval
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
n_batch
,
n_out
),
dtype
=
'int32'
)
yval
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
n_batch
,
n_out
),
dtype
=
'int32'
)
#FRED: THIS DON'T WORK. THIS SET YVAL TO ALL ZERO!
lr
=
numpy
.
asarray
(
0.01
,
dtype
=
'float32'
)
for
i
in
xrange
(
10
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论