Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9a70e813
提交
9a70e813
authored
9月 30, 2015
作者:
carriepl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bug and refactor in cython backend
上级
5e358424
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
43 行增加
和
36 行删除
+43
-36
scan_perform.c
theano/scan_module/scan_perform.c
+0
-0
scan_perform.pyx
theano/scan_module/scan_perform.pyx
+42
-35
scan_perform_ext.py
theano/scan_module/scan_perform_ext.py
+1
-1
没有找到文件。
theano/scan_module/scan_perform.c
浏览文件 @
9a70e813
This source diff could not be displayed because it is too large. You can
view the blob
instead.
theano/scan_module/scan_perform.pyx
浏览文件 @
9a70e813
...
@@ -62,7 +62,7 @@ import copy
...
@@ -62,7 +62,7 @@ import copy
def get_version():
def get_version():
return 0.28
8
return 0.28
9
@cython.boundscheck(False)
@cython.boundscheck(False)
def perform(
def perform(
...
@@ -445,7 +445,7 @@ def perform(
...
@@ -445,7 +445,7 @@ def perform(
# modified inplace and nothing needs to be done.
# modified inplace and nothing needs to be done.
if not same_data:
if not same_data:
outs[j][0][<unsigned int>(k + pos[j])] = \
outs[j][0][<unsigned int>(k + pos[j])] = \
input_storage[<unsigned int>
inp_idx
].storage[0]
input_storage[<unsigned int>
(n_seqs + inp_idx)
].storage[0]
else:
else:
# This output tap has not been preallocated, recover
# This output tap has not been preallocated, recover
...
@@ -465,45 +465,35 @@ def perform(
...
@@ -465,45 +465,35 @@ def perform(
for j in range(begin, end):
for j in range(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
# Copy the output value to `outs`, if necessary
# Copy the output value to `outs`, if necessary
if store_steps[j] == 1 or vector_outs[j] == 1
or not output_reused
:
if store_steps[j] == 1 or vector_outs[j] == 1:
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]
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]] = \
output_storage[<unsigned int>(offset_out+j)].storage[0]
# 5.5 Copy over the values for nit_sot outputs
# 5.5 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):
# 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],) + output_storage[jout].storage[0].shape
shape = (store_steps[j],) + output_storage[jout].storage[0].shape
...
@@ -518,9 +508,26 @@ def perform(
...
@@ -518,9 +508,26 @@ def perform(
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 vector_outs[j] == 1 or
elif store_steps[j] == 1 or vector_outs[j] == 1:
not output_reused):
outs[j][0][pos[j]] = output_storage[j+offset_out].storage[0]
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]] = output_storage[j+offset_out].storage[0]
# 5.6 Copy over the values for outputs corresponding to shared
# 5.6 Copy over the values for outputs corresponding to shared
# variables
# variables
...
...
theano/scan_module/scan_perform_ext.py
浏览文件 @
9a70e813
...
@@ -17,7 +17,7 @@ from theano.gof import cmodule
...
@@ -17,7 +17,7 @@ from theano.gof import cmodule
_logger
=
logging
.
getLogger
(
'theano.scan_module.scan_perform'
)
_logger
=
logging
.
getLogger
(
'theano.scan_module.scan_perform'
)
version
=
0.28
8
# must match constant returned in function get_version()
version
=
0.28
9
# must match constant returned in function get_version()
need_reload
=
False
need_reload
=
False
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论