Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4d2b7842
提交
4d2b7842
authored
2月 10, 2011
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
whitespace/indent clean up.
上级
dc827201
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
test_mlp.py
theano/sandbox/cuda/tests/test_mlp.py
+10
-10
没有找到文件。
theano/sandbox/cuda/tests/test_mlp.py
浏览文件 @
4d2b7842
...
...
@@ -60,7 +60,7 @@ def print_diff_mode(a,b):
def
run_nnet
(
use_gpu
,
n_batch
=
60
,
n_in
=
1024
,
n_hid
=
2048
,
n_out
=
10
,
n_train
=
100
):
if
config
.
mode
==
'DEBUG_MODE'
:
n_train
=
1
if
use_gpu
:
w
=
tcn
.
shared_constructor
(
0.01
*
(
my_rand
(
n_in
,
n_hid
)
-
0.5
),
'w'
)
b
=
tcn
.
shared_constructor
(
my_zeros
(
n_hid
),
'b'
)
...
...
@@ -88,7 +88,7 @@ def run_nnet(use_gpu, n_batch=60, n_in=1024, n_hid=2048, n_out=10, n_train=100):
print
'building pfunc ...'
train
=
pfunc
([
x
,
y
,
lr
],
[
loss
],
mode
=
mode
,
updates
=
[(
p
,
p
-
g
)
for
p
,
g
in
zip
(
params
,
gparams
)])
if
0
:
for
i
,
n
in
enumerate
(
train
.
maker
.
env
.
toposort
()):
print
i
,
n
...
...
@@ -102,10 +102,10 @@ def run_nnet(use_gpu, n_batch=60, n_in=1024, n_hid=2048, n_out=10, n_train=100):
for
i
in
xrange
(
n_train
):
rval
.
append
(
train
(
xval
,
yval
,
lr
))
dt
=
time
.
time
()
-
t0
print_mode
(
mode
)
return
numpy
.
asarray
(
rval
),
dt
def
test_run_nnet
():
for
n_in
in
1024
,
2048
,
4096
:
for
n_hid
in
1024
,
2048
,
4096
:
...
...
@@ -368,8 +368,8 @@ def run_conv_nnet2_classif(use_gpu, isize, ksize, n_batch, n_train,
print_mode
(
mode
)
return
rvals
,
t1
-
t0
,
mode
def
cmp_run_conv_nnet2_classif
(
seed
,
isize
,
ksize
,
bsize
,
ignore_error
=
False
,
def
cmp_run_conv_nnet2_classif
(
seed
,
isize
,
ksize
,
bsize
,
ignore_error
=
False
,
n_train
=
10
,
gpu_only
=
False
,
cpu_only
=
False
,
...
...
@@ -387,7 +387,7 @@ def cmp_run_conv_nnet2_classif(seed, isize, ksize, bsize,
numpy
.
random
.
seed
(
seed
)
orig_float32_atol
=
theano
.
tensor
.
basic
.
float32_atol
orig_float32_atol
=
theano
.
tensor
.
basic
.
float32_atol
try
:
if
gpu_only
:
tcn
.
use
()
...
...
@@ -403,7 +403,7 @@ def cmp_run_conv_nnet2_classif(seed, isize, ksize, bsize,
if
gpu_only
:
print
"time gpu:
%.3
f"
%
(
tg
)
return
try
:
numpy
.
random
.
seed
(
seed
)
rval_cpu
,
tc
,
cpu_mode
=
run_conv_nnet2_classif
(
False
,
isize
,
ksize
,
bsize
,
n_train
,
...
...
@@ -422,7 +422,7 @@ def cmp_run_conv_nnet2_classif(seed, isize, ksize, bsize,
theano
.
tensor
.
basic
.
float32_atol
=
orig_float32_atol
if
not
cpu_only
:
if
verbose
or
not
numpy
.
allclose
(
rval_cpu
,
rval_gpu
,
rtol
=
1e-3
,
atol
=
float_atol
):
if
verbose
or
not
numpy
.
allclose
(
rval_cpu
,
rval_gpu
,
rtol
=
1e-3
,
atol
=
float_atol
):
print
"cpu:"
,
rval_cpu
print
"gpu:"
,
rval_gpu
print
"abs diff:"
,
numpy
.
absolute
(
rval_gpu
-
rval_cpu
)
...
...
@@ -453,7 +453,7 @@ def test_lenet_32(): #CIFAR10 / Shapeset
verbose
=
verbose
,
version
=
version
)
def
test_lenet_32_long
():
#CIFAR10 / Shapeset
# this tests the gradient of downsample on the GPU,
# this tests the gradient of downsample on the GPU,
# which does not recieve specific testing
cmp_run_conv_nnet2_classif
(
23485
,
32
,
5
,
30
,
n_train
=
50
,
ignore_error
=
ignore_error
,
gpu_only
=
gpu_only
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论