Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ce069767
提交
ce069767
authored
1月 25, 2012
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PEP8 fixes
上级
83cab8bf
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
14 行增加
和
12 行删除
+14
-12
test_scan.py
theano/sandbox/scan_module/tests/test_scan.py
+14
-12
没有找到文件。
theano/sandbox/scan_module/tests/test_scan.py
浏览文件 @
ce069767
...
...
@@ -135,7 +135,7 @@ class TestScan(unittest.TestCase):
else
:
shared_outs
=
[
sh
*
5
for
sh
in
shared_vars
]
states_out
=
[
x
for
x
in
states_out
]
pure_outs
=
[
2
for
x
in
xrange
(
n_outputs
)]
pure_outs
=
[
2
for
x
in
xrange
(
n_outputs
)]
return
states_out
+
pure_outs
,
dict
(
zip
(
shared_vars
,
shared_outs
))
...
...
@@ -220,7 +220,7 @@ class TestScan(unittest.TestCase):
if
to_add
is
not
None
:
shared_values
=
[
sh
*
5
+
to_add
for
sh
in
shared_values
]
for
state
in
nw_states_outs
:
state
[
step
]
+=
to_add
state
[
step
]
+=
to_add
for
out
in
out_mem_buffers
:
out
[
step
]
=
to_add
**
2
else
:
...
...
@@ -249,7 +249,7 @@ class TestScan(unittest.TestCase):
if
n_steps
is
not
None
and
abs
(
n_steps
)
==
1
:
all_nodes
=
my_f
.
maker
.
env
.
toposort
()
assert
len
([
x
for
x
in
all_nodes
if
isinstance
(
x
.
op
,
ScanOp
)])
==
0
if
isinstance
(
x
.
op
,
ScanOp
)])
==
0
print
>>
sys
.
stderr
,
' n_steps'
,
n_steps
print
>>
sys
.
stderr
,
' go_backwards'
,
go_backwards
...
...
@@ -319,7 +319,8 @@ class TestScan(unittest.TestCase):
if
n_steps
is
not
None
:
# loose inputs make sense only when n_steps is
# defined
data
=
rng
.
uniform
(
size
=
(
abs
(
_n_steps
)
+
offset
+
pos
+
1
,
4
))
data
=
rng
.
uniform
(
size
=
(
abs
(
_n_steps
)
+
offset
+
pos
+
1
,
4
))
else
:
data
=
rng
.
uniform
(
size
=
(
abs
(
_n_steps
)
+
offset
,
4
))
input_values
.
append
(
data
)
...
...
@@ -400,9 +401,9 @@ class TestScan(unittest.TestCase):
[
dict
(
tap
=-
2
,
use
=
True
),
dict
(
tap
=
3
,
use
=
True
)]]
test_nb
=
0
for
n_ins
in
[
1
,
2
]:
for
n_ins
in
[
1
,
2
]:
# Randomly pick up 4*n_ins combinations of arguments
for
k
in
xrange
(
4
*
n_ins
):
for
k
in
xrange
(
4
*
n_ins
):
inp
=
[]
for
inp_nb
in
xrange
(
n_ins
):
...
...
@@ -424,9 +425,9 @@ class TestScan(unittest.TestCase):
dict
(
tap
=-
2
,
use
=
True
)],
[
dict
(
tap
=-
4
,
use
=
False
),
dict
(
tap
=-
2
,
use
=
True
)]]
for
n_ins
in
[
1
,
2
]:
for
n_ins
in
[
1
,
2
]:
# Randomly pick up 4*n_ins combinations of arguments
for
k
in
xrange
(
4
*
n_ins
):
for
k
in
xrange
(
4
*
n_ins
):
state
=
[]
for
state_nb
in
xrange
(
n_ins
):
pos
=
rng
.
randint
(
len
(
possible_taps_use_pairs
))
...
...
@@ -442,8 +443,8 @@ class TestScan(unittest.TestCase):
# The test will also have to be changesd following some further
# restriction of scan and reduction of the number of corner cases
return
for
n_outputs
in
[
0
,
1
,
2
]:
for
n_shared_updates
in
[
0
,
1
,
2
]:
for
n_outputs
in
[
0
,
1
,
2
]:
for
n_shared_updates
in
[
0
,
1
,
2
]:
for
n_random_combinations
in
xrange
(
1
):
pos_inp
=
rng
.
randint
(
len
(
all_inputs_info
))
pos_st
=
rng
.
randint
(
len
(
all_states_info
))
...
...
@@ -463,8 +464,6 @@ class TestScan(unittest.TestCase):
n_outputs
=
n_outputs
,
n_shared_updates
=
n_shared_updates
)
def
test002_generator_one_scalar_output
(
self
):
# The test fails, because the `work-in-progress` ScanOp always runs in
# place (even when told not to by DebugMode). As this op will change
...
...
@@ -472,6 +471,7 @@ class TestScan(unittest.TestCase):
# error is marked as KnownFailure
raise
KnownFailureTest
(
'Work-in-progress sandbox ScanOp is not fully '
'functional yet'
)
def
f_pow2
(
x_tm1
):
return
2
*
x_tm1
...
...
@@ -506,8 +506,10 @@ class TestScan(unittest.TestCase):
# place (even when told not to by DebugMode). As this op will change
# soon, and it is in the sandbox and not for user consumption, the
# error is marked as KnownFailure
raise
KnownFailureTest
(
'Work-in-progress sandbox ScanOp is not fully '
'functional yet'
)
def
f_rnn
(
u_t
,
x_tm1
,
W_in
,
W
):
return
u_t
*
W_in
+
x_tm1
*
W
u
=
theano
.
tensor
.
vector
(
'u'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论