Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f303478f
提交
f303478f
authored
8月 11, 2015
作者:
ChienliMa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delete update should be done after swap sv
上级
876507f6
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
11 行增加
和
12 行删除
+11
-12
function_module.py
theano/compile/function_module.py
+10
-11
test_function_module.py
theano/compile/tests/test_function_module.py
+1
-1
没有找到文件。
theano/compile/function_module.py
浏览文件 @
f303478f
...
@@ -611,16 +611,6 @@ class Function(object):
...
@@ -611,16 +611,6 @@ class Function(object):
for
out_ori
,
out_cpy
in
zip
(
maker
.
outputs
,
outs
):
for
out_ori
,
out_cpy
in
zip
(
maker
.
outputs
,
outs
):
out_cpy
.
borrow
=
out_ori
.
borrow
out_cpy
.
borrow
=
out_ori
.
borrow
# Delete update if needed
update_i
=
len
(
outs
)
for
i
,
in_var
in
zip
(
ins
,
fg_cpy
.
inputs
):
i
.
variable
=
in_var
if
not
delete_updates
and
i
.
update
is
not
None
:
i
.
update
=
fg_cpy
.
outputs
[
update_i
]
update_i
+=
1
else
:
i
.
update
=
None
# swap SharedVariable
# swap SharedVariable
if
swap
is
not
None
:
if
swap
is
not
None
:
swap_svs_ori
=
swap
.
keys
()
swap_svs_ori
=
swap
.
keys
()
...
@@ -650,9 +640,18 @@ class Function(object):
...
@@ -650,9 +640,18 @@ class Function(object):
swap_sv
=
swap_sv
.
clone
()
swap_sv
=
swap_sv
.
clone
()
# Swap SharedVariable in fgraph
# Swap SharedVariable in fgraph
# fg_cpy.inputs[index] = swap_sv
fg_cpy
.
replace
(
in_v
,
swap_sv
,
reason
=
"Swap SV"
)
fg_cpy
.
replace
(
in_v
,
swap_sv
,
reason
=
"Swap SV"
)
# Delete update if needed
update_i
=
len
(
outs
)
for
i
,
in_var
in
zip
(
ins
,
fg_cpy
.
inputs
):
i
.
variable
=
in_var
if
not
delete_updates
and
i
.
update
is
not
None
:
i
.
update
=
fg_cpy
.
outputs
[
update_i
]
update_i
+=
1
else
:
i
.
update
=
None
# 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
storage_map
=
self
.
fn
.
storage_map
...
...
theano/compile/tests/test_function_module.py
浏览文件 @
f303478f
...
@@ -313,7 +313,7 @@ class T_function(unittest.TestCase):
...
@@ -313,7 +313,7 @@ class T_function(unittest.TestCase):
elif
second_time
:
elif
second_time
:
# doule update for sharedvariable
# doule update for sharedvariable
assert
m
.
get_value
()
==
12
assert
m
.
get_value
()
==
12
assert
z
.
get_value
()
==
3
assert
z
.
get_value
()
==
4
assert
z_rpl
.
get_value
()
==
8
assert
z_rpl
.
get_value
()
==
8
assert
y_rpl
.
get_value
()
==
3
assert
y_rpl
.
get_value
()
==
3
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论