Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
682385f7
提交
682385f7
authored
8月 12, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make a scan test take less than 3 hours on the buildbot in DEBUG_MODE.
上级
9de86161
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
13 行增加
和
6 行删除
+13
-6
test_scan.py
theano/scan_module/tests/test_scan.py
+13
-6
没有找到文件。
theano/scan_module/tests/test_scan.py
浏览文件 @
682385f7
...
...
@@ -1777,8 +1777,16 @@ class T_Scan(unittest.TestCase):
analytic_grad
=
reset_rng_grad_fn
(
v_u
,
v_x0
,
vW_in
)
utt
.
assert_allclose
(
analytic_grad
[
0
][:
2
],
numpy
.
zeros
((
2
,
2
)))
@attr
(
'slow'
)
def
test_grad_multiple_outs_some_disconnected
(
self
):
final_cost
=
self
.
_grad_mout_helper
(
100
,
mode_nodebug
)
assert
final_cost
<
0.02
def
test_grad_multiple_outs_some_disconnected_2
(
self
):
# This is to try the network in DEBUG_MODE, but not fully
# train it since that would take 3 hours
self
.
_grad_mout_helper
(
1
,
None
)
def
_grad_mout_helper
(
self
,
n_iters
,
mode
):
# Created on Tue Oct 07 13:28:51 2014
# @author: vaneetke
rng
=
numpy
.
random
.
RandomState
(
utt
.
fetch_seed
())
...
...
@@ -1820,7 +1828,8 @@ class T_Scan(unittest.TestCase):
sequences
=
dict
(
input
=
x
),
# corresponds to the return type of one_step
outputs_info
=
[
dict
(
initial
=
h0
,
taps
=
[
-
2
,
-
1
]),
None
],
non_sequences
=
[
W_ih
,
W_hh
,
b_h
,
W_ho
,
b_o
])
non_sequences
=
[
W_ih
,
W_hh
,
b_h
,
W_ho
,
b_o
],
mode
=
mode
)
# target values
t
=
tensor
.
matrix
()
...
...
@@ -1835,8 +1844,6 @@ class T_Scan(unittest.TestCase):
gparams
=
theano
.
grad
(
cost
,
params
)
updates
=
[(
param
,
param
-
gparam
*
learning_rate
)
for
param
,
gparam
in
zip
(
params
,
gparams
)]
mode
=
copy
.
copy
(
theano
.
compile
.
get_default_mode
())
mode
.
check_py_code
=
False
learn_rnn_fn
=
theano
.
function
(
inputs
=
[
x
,
t
],
outputs
=
cost
,
updates
=
updates
,
...
...
@@ -1851,10 +1858,10 @@ class T_Scan(unittest.TestCase):
s_v
=
numpy
.
sin
(
x_v
)
t_v
=
numpy
.
roll
(
s_v
,
-
1
)[:
-
1
]
s_v
=
s_v
[:
-
1
]
for
i
in
xrange
(
100
):
for
i
in
xrange
(
n_iters
):
cost
=
learn_rnn_fn
(
s_v
,
t_v
)
pred
=
eval_rnn_fn
(
s_v
)
assert
cost
<
0.02
return
cost
def
test_draw_as_input_to_scan
(
self
):
trng
=
theano
.
tensor
.
shared_randomstreams
.
RandomStreams
(
123
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论