Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
52201224
提交
52201224
authored
6月 24, 2015
作者:
ChienliMa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rewrap Outs to avoid deepcopy whole graph
上级
b6c5be0f
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
6 行增加
和
7 行删除
+6
-7
function_module.py
theano/compile/function_module.py
+6
-7
没有找到文件。
theano/compile/function_module.py
浏览文件 @
52201224
...
@@ -573,13 +573,13 @@ class Function(object):
...
@@ -573,13 +573,13 @@ class Function(object):
"""
"""
maker
=
self
.
maker
maker
=
self
.
maker
# Copy Ins, so that they have different storage as their value
# Copy Ins, so that they have different storage as their value
ins
,
outs
=
copy
.
deepcopy
([
maker
.
inputs
,
maker
.
outputs
]
)
ins
=
copy
.
deepcopy
(
maker
.
inputs
)
# Delete update output in fgraph and updates In instancesis needed
# Delete update output in fgraph and updates In instancesis needed
if
delete_updates
:
if
delete_updates
:
# The first len(
o
uts) variabels are original variables.
# The first len(
maker.outp
uts) variabels are original variables.
# The rest are the updates.
# The rest are the updates.
out_vars
=
maker
.
fgraph
.
outputs
[:
len
(
o
uts
)]
out_vars
=
maker
.
fgraph
.
outputs
[:
len
(
maker
.
outp
uts
)]
else
:
else
:
out_vars
=
maker
.
fgraph
.
outputs
out_vars
=
maker
.
fgraph
.
outputs
...
@@ -591,8 +591,7 @@ class Function(object):
...
@@ -591,8 +591,7 @@ class Function(object):
clone
=
False
)
clone
=
False
)
# Swap varaible in Outs.
# Swap varaible in Outs.
for
i
in
xrange
(
len
(
outs
)):
outs
=
map
(
SymbolicOutput
,
maker
.
fgraph
.
outputs
[:
len
(
maker
.
outputs
)])
outs
[
i
]
.
variable
=
fg_cpy
.
outputs
[
i
]
# Swap update and variable in Ins
# Swap update and variable in Ins
# By doing this, we can pass FunctionMaker._check_unused_inputs()
# By doing this, we can pass FunctionMaker._check_unused_inputs()
...
@@ -644,10 +643,10 @@ class Function(object):
...
@@ -644,10 +643,10 @@ class Function(object):
i
.
variable
=
swap_sv
i
.
variable
=
swap_sv
i
.
value
=
swap_sv
.
container
i
.
value
=
swap_sv
.
container
storage_map
=
self
.
fn
.
storage_map
new_storage_map
=
{}
# Construct new storage_map that map new variable to old storage,
# Construct new storage_map that map new variable to old storage,
# so that the ensuing function shares storage with the original one
# so that the ensuing function shares storage with the original one
storage_map
=
self
.
fn
.
storage_map
new_storage_map
=
{}
# TODO: We could share the output storage, but we must make sure
# TODO: We could share the output storage, but we must make sure
# 2 different function call won't override each other values. This
# 2 different function call won't override each other values. This
# is already done elsewhere, so to reuse it the user would need to
# is already done elsewhere, so to reuse it the user would need to
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论