Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a8bc1124
提交
a8bc1124
authored
8月 07, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
back-port to python2.5
上级
98cc3ce8
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
8 行删除
+10
-8
scan_opt.py
theano/scan_module/scan_opt.py
+10
-8
没有找到文件。
theano/scan_module/scan_opt.py
浏览文件 @
a8bc1124
...
@@ -144,7 +144,7 @@ def remove_constants_and_unused_inputs_scan(node):
...
@@ -144,7 +144,7 @@ def remove_constants_and_unused_inputs_scan(node):
nw_info
[
'n_seqs'
]
=
nw_n_seqs
nw_info
[
'n_seqs'
]
=
nw_n_seqs
# DEBUG CHECK
# DEBUG CHECK
nwScan
=
scan_op
.
Scan
(
nw_inner
,
op_outs
,
nw_info
)
nwScan
=
scan_op
.
Scan
(
nw_inner
,
op_outs
,
nw_info
)
nw_outs
=
nwScan
(
*
nw_outer
,
return_list
=
True
)
nw_outs
=
nwScan
(
*
nw_outer
,
**
dict
(
return_list
=
True
)
)
return
nw_outs
return
nw_outs
else
:
else
:
return
False
return
False
...
@@ -230,7 +230,7 @@ class PushOutNonSeqScan(gof.Optimizer):
...
@@ -230,7 +230,7 @@ class PushOutNonSeqScan(gof.Optimizer):
# Do not call make_node for test_value
# Do not call make_node for test_value
nw_outer_node
=
nd
.
op
(
*
outside_ins
,
nw_outer_node
=
nd
.
op
(
*
outside_ins
,
return_list
=
True
)[
0
]
.
owner
**
dict
(
return_list
=
True
)
)[
0
]
.
owner
# Step 2. Create variables for replacements
# Step 2. Create variables for replacements
for
idx
,
y
in
enumerate
(
nd
.
outputs
):
for
idx
,
y
in
enumerate
(
nd
.
outputs
):
...
@@ -291,7 +291,8 @@ class PushOutNonSeqScan(gof.Optimizer):
...
@@ -291,7 +291,8 @@ class PushOutNonSeqScan(gof.Optimizer):
nwScan
=
scan_op
.
Scan
(
op_ins
,
op_outs
,
op
.
info
)
nwScan
=
scan_op
.
Scan
(
op_ins
,
op_outs
,
op
.
info
)
# Do not call make_node for test_value
# Do not call make_node for test_value
nw_node
=
nwScan
(
*
(
node
.
inputs
+
nw_outer
),
return_list
=
True
)[
0
]
.
owner
nw_node
=
nwScan
(
*
(
node
.
inputs
+
nw_outer
),
**
dict
(
return_list
=
True
))[
0
]
.
owner
fgraph
.
replace_all_validate_remove
(
fgraph
.
replace_all_validate_remove
(
zip
(
node
.
outputs
,
nw_node
.
outputs
),
zip
(
node
.
outputs
,
nw_node
.
outputs
),
...
@@ -395,7 +396,8 @@ class PushOutSeqScan(gof.Optimizer):
...
@@ -395,7 +396,8 @@ class PushOutSeqScan(gof.Optimizer):
'which is not allowed to move. Report '
'which is not allowed to move. Report '
'this on theano-users list'
),
x
)
'this on theano-users list'
),
x
)
# Do not call make_node for test_value
# Do not call make_node for test_value
nw_outer_node
=
nd
.
op
(
*
outside_ins
,
return_list
=
True
)[
0
]
.
owner
nw_outer_node
=
nd
.
op
(
*
outside_ins
,
**
dict
(
return_list
=
True
))[
0
]
.
owner
# Step 2. Create variables for replacements
# Step 2. Create variables for replacements
for
idx
,
y
in
enumerate
(
nd
.
outputs
):
for
idx
,
y
in
enumerate
(
nd
.
outputs
):
...
@@ -488,8 +490,8 @@ class PushOutSeqScan(gof.Optimizer):
...
@@ -488,8 +490,8 @@ class PushOutSeqScan(gof.Optimizer):
nw_info
[
'n_seqs'
]
+=
len
(
nw_inner
)
nw_info
[
'n_seqs'
]
+=
len
(
nw_inner
)
nwScan
=
scan_op
.
Scan
(
op_ins
,
op_outs
,
nw_info
)
nwScan
=
scan_op
.
Scan
(
op_ins
,
op_outs
,
nw_info
)
# Do not call make_node for test_value
# Do not call make_node for test_value
nw_node
=
nwScan
(
*
(
node
.
inputs
[:
1
]
+
nw_outer
+
nw_node
=
nwScan
(
*
(
node
.
inputs
[:
1
]
+
nw_outer
+
node
.
inputs
[
1
:]),
node
.
inputs
[
1
:]),
return_list
=
True
)[
0
]
.
owner
**
dict
(
return_list
=
True
)
)[
0
]
.
owner
fgraph
.
replace_all_validate_remove
(
fgraph
.
replace_all_validate_remove
(
zip
(
node
.
outputs
,
nw_node
.
outputs
),
zip
(
node
.
outputs
,
nw_node
.
outputs
),
...
@@ -580,7 +582,7 @@ class ScanInplaceOptimizer(Optimizer):
...
@@ -580,7 +582,7 @@ class ScanInplaceOptimizer(Optimizer):
typeConstructor
=
self
.
typeConstructor
)
typeConstructor
=
self
.
typeConstructor
)
# Do not call make_node for test_value
# Do not call make_node for test_value
new_outs
=
new_op
(
*
inputs
,
return_list
=
True
)
new_outs
=
new_op
(
*
inputs
,
**
dict
(
return_list
=
True
)
)
try
:
try
:
fgraph
.
replace_all_validate_remove
(
fgraph
.
replace_all_validate_remove
(
zip
(
node
.
outputs
,
new_outs
),
zip
(
node
.
outputs
,
new_outs
),
...
@@ -966,7 +968,7 @@ class ScanSaveMem(gof.Optimizer):
...
@@ -966,7 +968,7 @@ class ScanSaveMem(gof.Optimizer):
# Do not call make_node for test_value
# Do not call make_node for test_value
new_outs
=
scan_op
.
Scan
(
inps
,
outs
,
info
)(
*
node_ins
,
new_outs
=
scan_op
.
Scan
(
inps
,
outs
,
info
)(
*
node_ins
,
return_list
=
True
)
**
dict
(
return_list
=
True
)
)
old_new
=
[]
old_new
=
[]
# 3.7 Get replace pairs for those outputs that do not change
# 3.7 Get replace pairs for those outputs that do not change
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论