Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
26a71eb7
提交
26a71eb7
authored
12月 04, 2015
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix extra scan discovered by example in gh-3663. This revert
50c3fd00
.
上级
d3e30815
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
18 行增加
和
12 行删除
+18
-12
scan_op.py
theano/scan_module/scan_op.py
+15
-11
test_scan_opt.py
theano/scan_module/tests/test_scan_opt.py
+3
-1
没有找到文件。
theano/scan_module/scan_op.py
浏览文件 @
26a71eb7
...
@@ -1607,28 +1607,32 @@ class Scan(PureOp):
...
@@ -1607,28 +1607,32 @@ class Scan(PureOp):
inner_ins_shapes
=
[]
inner_ins_shapes
=
[]
out_equivalent
=
OrderedDict
()
out_equivalent
=
OrderedDict
()
# The two following blocks are commented as it cause in some
# cases extra scans in the graph. See gh-XXX for the
# investigation.
# We skip the first outer input as it is the total or current number
# We skip the first outer input as it is the total or current number
# of iterations.
# of iterations.
# sequences
# sequences
seqs_shape
=
[
x
[
1
:]
for
x
in
input_shapes
[
1
:
1
+
self
.
n_seqs
]]
seqs_shape
=
[
x
[
1
:]
for
x
in
input_shapes
[
1
:
1
+
self
.
n_seqs
]]
inner_seqs
=
self
.
inputs
[:
self
.
n_seqs
]
#
inner_seqs = self.inputs[:self.n_seqs]
outer_seqs
=
node
.
inputs
[
1
:
1
+
self
.
n_seqs
]
#
outer_seqs = node.inputs[1:1 + self.n_seqs]
for
in_s
,
out_s
in
izip
(
inner_seqs
,
outer_seqs
):
#
for in_s, out_s in izip(inner_seqs, outer_seqs):
out_equivalent
[
in_s
]
=
out_s
[
0
]
#
out_equivalent[in_s] = out_s[0]
# mit_mot, mit_sot, sit_sot
# mit_mot, mit_sot, sit_sot
outer_inp_idx
=
1
+
self
.
n_seqs
#
outer_inp_idx = 1 + self.n_seqs
inner_inp_idx
=
self
.
n_seqs
#
inner_inp_idx = self.n_seqs
n_outs
=
self
.
n_mit_mot
+
self
.
n_mit_sot
+
self
.
n_sit_sot
n_outs
=
self
.
n_mit_mot
+
self
.
n_mit_sot
+
self
.
n_sit_sot
outs_shape
=
[]
outs_shape
=
[]
for
idx
in
xrange
(
n_outs
):
for
idx
in
xrange
(
n_outs
):
mintap
=
abs
(
min
(
self
.
tap_array
[
idx
]))
#
mintap = abs(min(self.tap_array[idx]))
for
k
in
self
.
tap_array
[
idx
]:
for
k
in
self
.
tap_array
[
idx
]:
outs_shape
+=
[
input_shapes
[
idx
+
self
.
n_seqs
+
1
][
1
:]]
outs_shape
+=
[
input_shapes
[
idx
+
self
.
n_seqs
+
1
][
1
:]]
corresponding_tap
=
node
.
inputs
[
outer_inp_idx
][
mintap
+
k
]
#
corresponding_tap = node.inputs[outer_inp_idx][mintap + k]
out_equivalent
[
self
.
inputs
[
inner_inp_idx
]]
=
corresponding_tap
#
out_equivalent[self.inputs[inner_inp_idx]] = corresponding_tap
inner_inp_idx
+=
1
#
inner_inp_idx += 1
outer_inp_idx
+=
1
#
outer_inp_idx += 1
# shared_outs
# shared_outs
offset
=
1
+
self
.
n_seqs
+
n_outs
offset
=
1
+
self
.
n_seqs
+
n_outs
...
...
theano/scan_module/tests/test_scan_opt.py
浏览文件 @
26a71eb7
...
@@ -212,7 +212,9 @@ class TestPushOutScanOutputDot(object):
...
@@ -212,7 +212,9 @@ class TestPushOutScanOutputDot(object):
# not be the result of a Dot
# not be the result of a Dot
scan_node
=
[
node
for
node
in
f_opt
.
maker
.
fgraph
.
toposort
()
scan_node
=
[
node
for
node
in
f_opt
.
maker
.
fgraph
.
toposort
()
if
isinstance
(
node
.
op
,
Scan
)][
0
]
if
isinstance
(
node
.
op
,
Scan
)][
0
]
assert
len
(
scan_node
.
op
.
outputs
)
==
1
# NOTE: WHEN INFER_SHAPE IS REENABLED, BELLOW THE SCAN MUST
# HAVE ONLY 1 OUTPUT.
assert
len
(
scan_node
.
op
.
outputs
)
==
2
assert
not
isinstance
(
scan_node
.
op
.
outputs
[
0
],
T
.
Dot
)
assert
not
isinstance
(
scan_node
.
op
.
outputs
[
0
],
T
.
Dot
)
# Ensure that the function compiled with the optimization produces
# Ensure that the function compiled with the optimization produces
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论