Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e43be997
提交
e43be997
authored
6月 06, 2015
作者:
ChienliMa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change of Ins/Outs copy strategy
上级
eff0d6ac
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
14 行增加
和
5 行删除
+14
-5
function_module.py
theano/compile/function_module.py
+14
-5
没有找到文件。
theano/compile/function_module.py
浏览文件 @
e43be997
...
...
@@ -568,11 +568,11 @@ class Function(object):
if
not
share_memory
:
return
self
.
__copy__
()
else
:
# copy SymbolocKits
ins
,
outs
=
copy
.
deepcopy
([
self
.
maker
.
inputs
,
self
.
maker
.
outputs
])
maker
=
self
.
maker
# copy Ins, so that they have different storage as their value
ins
=
copy
.
deepcopy
(
maker
.
inputs
)
# copy fgraph and get memo
maker
=
self
.
maker
fg_cpy
,
memo
=
maker
.
fgraph
.
clone_get_equiv
(
attach_feature
=
False
)
# construct new storage_map that map new variable to old storage
...
...
@@ -590,9 +590,17 @@ class Function(object):
if
key
not
in
maker
.
fgraph
.
outputs
:
new_storage_map
[
memo
[
key
]]
=
storage_map
[
key
]
# copy input storages if it's mutable
input_storage
=
[]
for
in_ori
,
in_cpy
in
zip
(
maker
.
inputs
,
ins
):
# Since we reuse original Out instances, the copied In
# instances should use the original variabls as their variables
# and updates. Otherwise the compilation will fail at function
# FunctionMaker._check_unused_inputs()
in_cpy
.
variable
=
in_ori
.
variable
in_cpy
.
update
=
in_ori
.
update
# share input storages if it's immutable
is_const
=
isinstance
(
in_ori
.
variable
,
theano
.
tensor
.
Constant
)
if
is_const
or
not
in_ori
.
mutable
:
storage
=
getattr
(
in_ori
,
'value'
,
None
)
...
...
@@ -602,7 +610,8 @@ class Function(object):
input_storage
.
append
(
storage
)
# reinitialize new maker and create new function
return
maker
.
__class__
(
inputs
=
ins
,
outputs
=
outs
,
fgraph
=
fg_cpy
,
return
maker
.
__class__
(
inputs
=
ins
,
outputs
=
maker
.
outputs
,
fgraph
=
fg_cpy
,
mode
=
maker
.
mode
,
profile
=
maker
.
profile
,
on_unused_input
=
maker
.
on_unused_input
,
function_builder
=
maker
.
function_builder
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论