Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
64694370
提交
64694370
authored
6月 23, 2015
作者:
ChienliMa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update docs; Delete debug code.
上级
09fe88b9
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
8 行删除
+10
-8
function_module.py
theano/compile/function_module.py
+10
-8
没有找到文件。
theano/compile/function_module.py
浏览文件 @
64694370
...
@@ -548,9 +548,9 @@ class Function(object):
...
@@ -548,9 +548,9 @@ class Function(object):
fgraph with original function. User can choose whether to separate
fgraph with original function. User can choose whether to separate
storage by changing the share_memory arguments.
storage by changing the share_memory arguments.
Note:
Note:
We reuse original Out instances but In instances, therefor
e variables
Originally, variables in In and Out instances are thos
e variables
in Ins and Outs are not in the same graph. Please avoid using variables
that defined by user. After being copied, variables in In/Outs are
is Ins and Outs to reinitialize another Function or FunctionGrao
h.
those variables in Function.maker.fgrap
h.
---------------------
---------------------
Params:
Params:
share_memory -- { boolean } Default is False. When True, two
share_memory -- { boolean } Default is False. When True, two
...
@@ -562,7 +562,9 @@ class Function(object):
...
@@ -562,7 +562,9 @@ class Function(object):
swap -- { dict } Dictionary<String, theano.SharedVariable> that
swap -- { dict } Dictionary<String, theano.SharedVariable> that
map old SharedVariable's name to new SharedVariable. Default is
map old SharedVariable's name to new SharedVariable. Default is
None.
None. The computational relationship is modified within the inner
fgraph, especially for this copied function. SharedVariables aren't
swapped in the relationship that user defined.
delete_updates -- { boolean } Default is False. If True, Copied
delete_updates -- { boolean } Default is False. If True, Copied
function will not have update.
function will not have update.
...
@@ -576,11 +578,12 @@ class Function(object):
...
@@ -576,11 +578,12 @@ class Function(object):
# 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(outs) variabels
would b
e original variables.
# The first len(outs) variabels
ar
e original variables.
# The rest
variables in fgraph.outputs
are the updates.
# The rest are the updates.
out_vars
=
maker
.
fgraph
.
outputs
[:
len
(
outs
)]
out_vars
=
maker
.
fgraph
.
outputs
[:
len
(
outs
)]
else
:
else
:
out_vars
=
maker
.
fgraph
.
outputs
out_vars
=
maker
.
fgraph
.
outputs
# Init new fgraph using copied variables and get memo
# Init new fgraph using copied variables and get memo
# memo: a dict that map old variables to new variabls
# memo: a dict that map old variables to new variabls
memo
=
graph
.
clone_get_equiv
(
maker
.
fgraph
.
inputs
,
out_vars
)
memo
=
graph
.
clone_get_equiv
(
maker
.
fgraph
.
inputs
,
out_vars
)
...
@@ -597,6 +600,7 @@ class Function(object):
...
@@ -597,6 +600,7 @@ class Function(object):
update_i
=
len
(
outs
)
update_i
=
len
(
outs
)
for
i
,
in_var
in
zip
(
ins
,
fg_cpy
.
inputs
):
for
i
,
in_var
in
zip
(
ins
,
fg_cpy
.
inputs
):
i
.
variable
=
in_var
i
.
variable
=
in_var
# Delete update if needed
if
not
delete_updates
and
i
.
update
is
not
None
:
if
not
delete_updates
and
i
.
update
is
not
None
:
i
.
update
=
fg_cpy
.
outputs
[
update_i
]
i
.
update
=
fg_cpy
.
outputs
[
update_i
]
update_i
+=
1
update_i
+=
1
...
@@ -609,8 +613,6 @@ class Function(object):
...
@@ -609,8 +613,6 @@ class Function(object):
# the name of SV we swapped
# the name of SV we swapped
swapped_sv
=
swap
.
keys
()
swapped_sv
=
swap
.
keys
()
print
(
fg_cpy
)
storage_map
=
self
.
fn
.
storage_map
storage_map
=
self
.
fn
.
storage_map
new_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,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论