Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5e358424
提交
5e358424
authored
9月 30, 2015
作者:
carriepl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bug and refactor in python backend
上级
7772a869
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
30 行增加
和
24 行删除
+30
-24
scan_op.py
theano/scan_module/scan_op.py
+30
-24
没有找到文件。
theano/scan_module/scan_op.py
浏览文件 @
5e358424
...
@@ -1370,7 +1370,7 @@ class Scan(PureOp):
...
@@ -1370,7 +1370,7 @@ class Scan(PureOp):
# and store it in `outs` as usual
# and store it in `outs` as usual
if
not
same_data
:
if
not
same_data
:
outs
[
j
][
0
][
k
+
pos
[
j
]]
=
\
outs
[
j
][
0
][
k
+
pos
[
j
]]
=
\
input_storage
[
inp_idx
]
.
storage
[
0
]
input_storage
[
self
.
n_seqs
+
inp_idx
]
.
storage
[
0
]
else
:
else
:
# This output tap has not been preallocated, recover
# This output tap has not been preallocated, recover
...
@@ -1390,12 +1390,17 @@ class Scan(PureOp):
...
@@ -1390,12 +1390,17 @@ class Scan(PureOp):
for
j
in
xrange
(
begin
,
end
):
for
j
in
xrange
(
begin
,
end
):
# Check whether the initialization of the output storage map
# Copy the output value to `outs`, if necessary
# for this output has been reused.
if
store_steps
[
j
]
==
1
or
self
.
vector_outs
[
j
]:
outs
[
j
][
0
][
pos
[
j
]]
=
\
output_storage
[
offset_out
+
j
]
.
storage
[
0
]
else
:
# Check whether the initialization of the output storage
# map for this output has been reused.
old_var
=
old_output_storage
[
offset_out
+
j
]
old_var
=
old_output_storage
[
offset_out
+
j
]
old_data
=
old_output_data
[
offset_out
+
j
]
new_var
=
output_storage
[
offset_out
+
j
]
.
storage
[
0
]
new_var
=
output_storage
[
offset_out
+
j
]
.
storage
[
0
]
if
old_var
is
new_var
:
if
old_var
is
new_var
:
old_data
=
old_output_data
[
offset_out
+
j
]
if
old_data
is
None
:
if
old_data
is
None
:
output_reused
=
False
output_reused
=
False
elif
hasattr
(
new_var
,
'gpudata'
):
elif
hasattr
(
new_var
,
'gpudata'
):
...
@@ -1405,9 +1410,7 @@ class Scan(PureOp):
...
@@ -1405,9 +1410,7 @@ class Scan(PureOp):
else
:
else
:
output_reused
=
False
output_reused
=
False
# Copy the output value to `outs`, if necessary
if
not
output_reused
:
if
(
store_steps
[
j
]
==
1
or
self
.
vector_outs
[
j
]
or
not
output_reused
):
outs
[
j
][
0
][
pos
[
j
]]
=
\
outs
[
j
][
0
][
pos
[
j
]]
=
\
output_storage
[
offset_out
+
j
]
.
storage
[
0
]
output_storage
[
offset_out
+
j
]
.
storage
[
0
]
...
@@ -1416,21 +1419,6 @@ class Scan(PureOp):
...
@@ -1416,21 +1419,6 @@ class Scan(PureOp):
end
+=
self
.
n_nit_sot
end
+=
self
.
n_nit_sot
for
j
in
xrange
(
begin
,
end
):
for
j
in
xrange
(
begin
,
end
):
# Check whether the initialization of the output storage map
# for this output has been reused.
old_var
=
old_output_storage
[
offset_out
+
j
]
old_data
=
old_output_data
[
offset_out
+
j
]
new_var
=
output_storage
[
offset_out
+
j
]
.
storage
[
0
]
if
old_var
is
new_var
:
if
old_data
is
None
:
output_reused
=
False
elif
hasattr
(
new_var
,
'gpudata'
):
output_reused
=
(
new_var
.
gpudata
==
old_data
)
elif
hasattr
(
new_var
,
'data'
):
output_reused
=
(
new_var
.
data
==
old_data
)
else
:
output_reused
=
False
if
i
==
0
:
if
i
==
0
:
jout
=
j
+
offset_out
jout
=
j
+
offset_out
shape
=
(
store_steps
[
j
],)
+
\
shape
=
(
store_steps
[
j
],)
+
\
...
@@ -1446,8 +1434,26 @@ class Scan(PureOp):
...
@@ -1446,8 +1434,26 @@ class Scan(PureOp):
elif
outs
[
j
][
0
]
.
shape
[
0
]
!=
store_steps
[
j
]:
elif
outs
[
j
][
0
]
.
shape
[
0
]
!=
store_steps
[
j
]:
outs
[
j
][
0
]
=
outs
[
j
][
0
][:
store_steps
[
j
]]
outs
[
j
][
0
]
=
outs
[
j
][
0
][:
store_steps
[
j
]]
outs
[
j
][
0
][
pos
[
j
]]
=
output_storage
[
jout
]
.
storage
[
0
]
outs
[
j
][
0
][
pos
[
j
]]
=
output_storage
[
jout
]
.
storage
[
0
]
elif
(
store_steps
[
j
]
==
1
or
self
.
vector_outs
[
j
]
or
elif
store_steps
[
j
]
==
1
or
self
.
vector_outs
[
j
]:
not
output_reused
):
outs
[
j
][
0
][
pos
[
j
]]
=
\
output_storage
[
j
+
offset_out
]
.
storage
[
0
]
else
:
# Check whether the initialization of the output storage map
# for this output has been reused.
old_var
=
old_output_storage
[
offset_out
+
j
]
old_data
=
old_output_data
[
offset_out
+
j
]
new_var
=
output_storage
[
offset_out
+
j
]
.
storage
[
0
]
if
old_var
is
new_var
:
if
old_data
is
None
:
output_reused
=
False
elif
hasattr
(
new_var
,
'gpudata'
):
output_reused
=
(
new_var
.
gpudata
==
old_data
)
elif
hasattr
(
new_var
,
'data'
):
output_reused
=
(
new_var
.
data
==
old_data
)
else
:
output_reused
=
False
if
not
output_reused
:
outs
[
j
][
0
][
pos
[
j
]]
=
\
outs
[
j
][
0
][
pos
[
j
]]
=
\
output_storage
[
j
+
offset_out
]
.
storage
[
0
]
output_storage
[
j
+
offset_out
]
.
storage
[
0
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论