Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5a70f9ae
提交
5a70f9ae
authored
7月 30, 2015
作者:
carriepl
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3221 from carriepl/scan_opt_bug
[ENH] Scan PushOutSeqScan
上级
c8394fb3
8d2a0845
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
28 行增加
和
6 行删除
+28
-6
configparser.py
theano/configparser.py
+4
-0
scan_opt.py
theano/scan_module/scan_opt.py
+7
-6
test_scan.py
theano/scan_module/tests/test_scan.py
+17
-0
没有找到文件。
theano/configparser.py
浏览文件 @
5a70f9ae
...
...
@@ -116,6 +116,10 @@ def change_flags(**kwargs):
if
v
.
fullname
==
k
]
assert
len
(
l
)
==
1
l
[
0
]
.
__set__
(
None
,
old_val
[
k
])
# Make sure that the name of the decorated function remains the same.
inner
.
__name__
=
f
.
__name__
return
inner
return
change_flags_exec
...
...
theano/scan_module/scan_opt.py
浏览文件 @
5a70f9ae
...
...
@@ -472,13 +472,12 @@ class PushOutSeqScan(gof.Optimizer):
for
nd
in
local_fgraph_topo
:
if
(
nd
not
in
to_remove_set
and
all
([(
x
in
inner_non_seqs_set
)
or
(
x
.
owner
in
to_remove_set
)
or
isinstance
(
x
,
tensor
.
Constant
)
or
(
x
in
inner_seqs_set
)
for
x
in
nd
.
inputs
])
and
isinstance
(
nd
.
op
,
theano
.
tensor
.
Elemwise
)):
all
([(
x
in
inner_non_seqs_set
)
or
(
x
.
owner
in
to_remove_set
)
or
isinstance
(
x
,
tensor
.
Constant
)
or
(
x
in
inner_seqs_set
)
for
x
in
nd
.
inputs
])
and
isinstance
(
nd
.
op
,
theano
.
tensor
.
Elemwise
)):
to_remove_set
.
add
(
nd
)
outside_ins
=
[]
depends_on_seqs
=
False
...
...
@@ -511,6 +510,8 @@ class PushOutSeqScan(gof.Optimizer):
# scan.
continue
to_remove_set
.
add
(
nd
)
# Do not call make_node for test_value
nw_outer_node
=
nd
.
op
(
*
outside_ins
,
**
dict
(
return_list
=
True
))[
0
]
.
owner
...
...
theano/scan_module/tests/test_scan.py
浏览文件 @
5a70f9ae
...
...
@@ -2696,6 +2696,23 @@ class T_Scan(unittest.TestCase):
utt
.
assert_allclose
(
expected_output
,
scan_output
)
utt
.
assert_allclose
(
expected_output
,
jacobian_outputs
)
@theano.configparser.change_flags
(
on_opt_error
=
'raise'
)
def
test_pushout_seqs2
(
self
):
# This test for a bug with PushOutSeqScan that was reported on the
# theano-user mailing list where the optimization raised an exception
# when applied on this graph.
x
=
tensor
.
matrix
()
outputs
,
updates
=
theano
.
scan
(
lambda
x
:
[
x
*
x
,
tensor
.
constant
(
0
)
.
copy
()
.
copy
()],
n_steps
=
2
,
sequences
=
[],
non_sequences
=
[],
outputs_info
=
[
x
,
None
])
# Compile a theano function where any optimization error will lead to
# an exception being raised
theano
.
function
([
x
],
outputs
,
updates
=
updates
)
def
test_sequence_dict
(
self
):
# Test that we can specify sequences as a dictionary with
# only the 'input' key
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论