Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1d53a4aa
提交
1d53a4aa
authored
9月 17, 2015
作者:
carriepl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rearrange numbering of the steps in the Scan backends
上级
9a281ed6
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
16 行增加
和
20 行删除
+16
-20
scan_op.py
theano/scan_module/scan_op.py
+8
-8
scan_perform.c
theano/scan_module/scan_perform.c
+0
-0
scan_perform.pyx
theano/scan_module/scan_perform.pyx
+8
-12
没有找到文件。
theano/scan_module/scan_op.py
浏览文件 @
1d53a4aa
...
@@ -1297,7 +1297,7 @@ class Scan(PureOp):
...
@@ -1297,7 +1297,7 @@ class Scan(PureOp):
else
:
else
:
old_input_data
[
idx
]
=
None
old_input_data
[
idx
]
=
None
# 5.
0.
1 compute outputs
# 5.1 compute outputs
t0_fn
=
time
.
time
()
t0_fn
=
time
.
time
()
try
:
try
:
...
@@ -1326,7 +1326,7 @@ class Scan(PureOp):
...
@@ -1326,7 +1326,7 @@ class Scan(PureOp):
pdx
=
offset
+
self
.
n_shared_outs
pdx
=
offset
+
self
.
n_shared_outs
cond
=
output_storage
[
pdx
]
.
storage
[
0
]
==
0
cond
=
output_storage
[
pdx
]
.
storage
[
0
]
==
0
# 5.
0.
2. By calling fn() directly instead of calling the theano
# 5.2. By calling fn() directly instead of calling the theano
# function, it is possible that the updates have not been
# function, it is possible that the updates have not been
# performed. Perform the updates if needed.
# performed. Perform the updates if needed.
offset_out
=
len
(
output_storage
)
-
1
offset_out
=
len
(
output_storage
)
-
1
...
@@ -1338,7 +1338,7 @@ class Scan(PureOp):
...
@@ -1338,7 +1338,7 @@ class Scan(PureOp):
storage
.
data
=
output_storage
[
offset_out
]
.
data
storage
.
data
=
output_storage
[
offset_out
]
.
data
offset_out
-=
1
offset_out
-=
1
# 5.
0.
3. Check which of the pre-allocated outputs (if applicable)
# 5.3. Check which of the pre-allocated outputs (if applicable)
# have been reused by the inner function
# have been reused by the inner function
for
idx
in
xrange
(
len
(
output_storage
)):
for
idx
in
xrange
(
len
(
output_storage
)):
# If the storage map does not contain the same object, then
# If the storage map does not contain the same object, then
...
@@ -1361,7 +1361,7 @@ class Scan(PureOp):
...
@@ -1361,7 +1361,7 @@ class Scan(PureOp):
else
:
else
:
output_reused
[
idx
]
=
False
output_reused
[
idx
]
=
False
# 5.
0.
4 Check which of the input storage have been modified by the
# 5.4 Check which of the input storage have been modified by the
# inner function
# inner function
for
idx
in
xrange
(
len
(
input_storage
)):
for
idx
in
xrange
(
len
(
input_storage
)):
# If the storage map does not contain the same object, then
# If the storage map does not contain the same object, then
...
@@ -1388,7 +1388,7 @@ class Scan(PureOp):
...
@@ -1388,7 +1388,7 @@ class Scan(PureOp):
t_fn
+=
dt_fn
t_fn
+=
dt_fn
offset_out
=
0
offset_out
=
0
# 5.
1
Copy over the values for mit_mot outputs
# 5.
5
Copy over the values for mit_mot outputs
mitmot_inp_offset
=
self
.
n_seqs
mitmot_inp_offset
=
self
.
n_seqs
mitmot_out_idx
=
0
mitmot_out_idx
=
0
for
j
in
xrange
(
self
.
n_mit_mot
):
for
j
in
xrange
(
self
.
n_mit_mot
):
...
@@ -1415,7 +1415,7 @@ class Scan(PureOp):
...
@@ -1415,7 +1415,7 @@ class Scan(PureOp):
mitmot_inp_offset
+=
len
(
self
.
tap_array
[
j
])
mitmot_inp_offset
+=
len
(
self
.
tap_array
[
j
])
# 5.
2
Copy over the values for mit_sot/sit_sot outputs
# 5.
6
Copy over the values for mit_sot/sit_sot outputs
begin
=
self
.
n_mit_mot
begin
=
self
.
n_mit_mot
end
=
self
.
n_outs
end
=
self
.
n_outs
offset_out
-=
self
.
n_mit_mot
offset_out
-=
self
.
n_mit_mot
...
@@ -1426,7 +1426,7 @@ class Scan(PureOp):
...
@@ -1426,7 +1426,7 @@ class Scan(PureOp):
outs
[
j
][
0
][
pos
[
j
]]
=
\
outs
[
j
][
0
][
pos
[
j
]]
=
\
output_storage
[
offset_out
+
j
]
.
storage
[
0
]
output_storage
[
offset_out
+
j
]
.
storage
[
0
]
# 5.
3
Copy over the values for nit_sot outputs
# 5.
7
Copy over the values for nit_sot outputs
begin
=
end
begin
=
end
end
+=
self
.
n_nit_sot
end
+=
self
.
n_nit_sot
for
j
in
xrange
(
begin
,
end
):
for
j
in
xrange
(
begin
,
end
):
...
@@ -1450,7 +1450,7 @@ class Scan(PureOp):
...
@@ -1450,7 +1450,7 @@ class Scan(PureOp):
outs
[
j
][
0
][
pos
[
j
]]
=
\
outs
[
j
][
0
][
pos
[
j
]]
=
\
output_storage
[
j
+
offset_out
]
.
storage
[
0
]
output_storage
[
j
+
offset_out
]
.
storage
[
0
]
# 5.
4
Copy over the values for outputs corresponding to shared
# 5.
8
Copy over the values for outputs corresponding to shared
# variables
# variables
begin
=
end
begin
=
end
end
+=
self
.
n_shared_outs
end
+=
self
.
n_shared_outs
...
...
theano/scan_module/scan_perform.c
浏览文件 @
1d53a4aa
This source diff could not be displayed because it is too large. You can
view the blob
instead.
theano/scan_module/scan_perform.pyx
浏览文件 @
1d53a4aa
...
@@ -382,7 +382,7 @@ def perform(
...
@@ -382,7 +382,7 @@ def perform(
else:
else:
old_input_data[idx] = None
old_input_data[idx] = None
# 5.
0.
1 compute outputs
# 5.1 compute outputs
t0_fn = time.time()
t0_fn = time.time()
try:
try:
...
@@ -403,7 +403,7 @@ def perform(
...
@@ -403,7 +403,7 @@ def perform(
pdx = offset + n_shared_outs
pdx = offset + n_shared_outs
cond = output_storage[pdx].storage[0] == 0
cond = output_storage[pdx].storage[0] == 0
# 5.
0.
2. By calling fn() directly instead of calling the theano
# 5.2. By calling fn() directly instead of calling the theano
# function, it is possible that the updates have not been
# function, it is possible that the updates have not been
# performed. Perform the updates if needed.
# performed. Perform the updates if needed.
offset_out = len(output_storage) - 1
offset_out = len(output_storage) - 1
...
@@ -415,7 +415,7 @@ def perform(
...
@@ -415,7 +415,7 @@ def perform(
storage.data = output_storage[offset_out].data
storage.data = output_storage[offset_out].data
offset_out -= 1
offset_out -= 1
# 5.
0.
3. Check which of the pre-allocated outputs (if applicable)
# 5.3. Check which of the pre-allocated outputs (if applicable)
# have been reused by the inner function
# have been reused by the inner function
for idx in range(len_output_storage):
for idx in range(len_output_storage):
# If the storage map does not contain the same object, then
# If the storage map does not contain the same object, then
...
@@ -438,7 +438,7 @@ def perform(
...
@@ -438,7 +438,7 @@ def perform(
else:
else:
output_reused[idx] = False
output_reused[idx] = False
# 5.
0.
4. Check which of the input storage have been modified by the
# 5.4. Check which of the input storage have been modified by the
# inner function
# inner function
for idx in xrange(len(input_storage)):
for idx in xrange(len(input_storage)):
# If the storage map does not contain the same object, then
# If the storage map does not contain the same object, then
...
@@ -461,9 +461,8 @@ def perform(
...
@@ -461,9 +461,8 @@ def perform(
else:
else:
input_reused[idx] = False
input_reused[idx] = False
offset_out = 0
offset_out = 0
# 5.
1
Copy over the values for mit_mot outputs
# 5.
5
Copy over the values for mit_mot outputs
mitmot_inp_offset = self.n_seqs
mitmot_inp_offset = self.n_seqs
mitmot_out_idx = 0
mitmot_out_idx = 0
for j in xrange(self.n_mit_mot):
for j in xrange(self.n_mit_mot):
...
@@ -490,7 +489,7 @@ def perform(
...
@@ -490,7 +489,7 @@ def perform(
mitmot_inp_offset += len(self.tap_array[j])
mitmot_inp_offset += len(self.tap_array[j])
# 5.
2
Copy over the values for mit_sot/sit_sot outputs
# 5.
6
Copy over the values for mit_sot/sit_sot outputs
begin = n_mit_mot
begin = n_mit_mot
end = n_outs
end = n_outs
offset_out -= n_mit_mot
offset_out -= n_mit_mot
...
@@ -501,7 +500,7 @@ def perform(
...
@@ -501,7 +500,7 @@ def perform(
outs[j][0][pos[j]] = output_storage[<unsigned int>(offset_out+j)].storage[0]
outs[j][0][pos[j]] = output_storage[<unsigned int>(offset_out+j)].storage[0]
# 5.
3
Copy over the values for nit_sot outputs
# 5.
7
Copy over the values for nit_sot outputs
begin = end
begin = end
end += n_nit_sot
end += n_nit_sot
for j in range(begin,end):
for j in range(begin,end):
...
@@ -523,8 +522,7 @@ def perform(
...
@@ -523,8 +522,7 @@ def perform(
not output_reused[<unsigned int>(offset_out+j)]):
not output_reused[<unsigned int>(offset_out+j)]):
outs[j][0][pos[j]] = output_storage[j+offset_out].storage[0]
outs[j][0][pos[j]] = output_storage[j+offset_out].storage[0]
# 5.8 Copy over the values for outputs corresponding to shared
# 5.4 Copy over the values for outputs corresponding to shared
# variables
# variables
begin = end
begin = end
end += n_shared_outs
end += n_shared_outs
...
@@ -536,8 +534,6 @@ def perform(
...
@@ -536,8 +534,6 @@ def perform(
pos[idx] = (pos[idx]+1)%store_steps[idx]
pos[idx] = (pos[idx]+1)%store_steps[idx]
i = i + 1
i = i + 1
# 6. Check if you need to re-order output buffers
# 6. Check if you need to re-order output buffers
begin = n_mit_mot
begin = n_mit_mot
end = n_outs + n_nit_sot
end = n_outs + n_nit_sot
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论