Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
520fd3b2
提交
520fd3b2
authored
9月 13, 2012
作者:
Matthew Rocklin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
replace toposort with schedule in Linker code
replace code like order = fgraph.toposort() with code like order = self.schedule(fgraph) in Linker code
上级
e76dbade
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
14 行增加
和
12 行删除
+14
-12
debugmode.py
theano/compile/debugmode.py
+2
-2
profilemode.py
theano/compile/profilemode.py
+1
-1
cc.py
theano/gof/cc.py
+4
-5
link.py
theano/gof/link.py
+5
-2
vm.py
theano/gof/vm.py
+1
-1
scan_op.py
theano/scan_module/scan_op.py
+1
-1
没有找到文件。
theano/compile/debugmode.py
浏览文件 @
520fd3b2
...
...
@@ -1574,7 +1574,7 @@ class _Linker(gof.link.LocalLinker):
fgraph
=
self
.
fgraph
input_storage_
=
input_storage
output_storage_
=
output_storage
#order =
fgraph.toposort(
)
#order =
self.schedule(fgraph
)
#Compute a topological ordering that IGNORES the destroy_map of destructive Ops.
#This will be OK, because every thunk is evaluated on a copy of its input.
...
...
@@ -1582,7 +1582,7 @@ class _Linker(gof.link.LocalLinker):
order_outputs
.
reverse
()
order
=
graph
.
io_toposort
(
fgraph
.
inputs
,
order_outputs
)
active_order
=
fgraph
.
toposort
()
# an ordering of just the active nodes
active_order
=
self
.
schedule
(
fgraph
)
# an ordering of just the active nodes
active_order_set
=
set
(
active_order
)
no_recycling
=
self
.
no_recycling
...
...
theano/compile/profilemode.py
浏览文件 @
520fd3b2
...
...
@@ -538,7 +538,7 @@ class ProfileMode(Mode):
items
.
sort
(
key
=
lambda
a
:
a
[
1
])
items
.
reverse
()
order
=
fgraph
.
toposort
(
)
order
=
self
.
linker
.
schedule
(
fgraph
)
computed
,
last_user
=
gof
.
link
.
gc_helper
(
order
)
for
node
in
order
:
post_thunk_old_storage
.
append
([
input_idx
...
...
theano/gof/cc.py
浏览文件 @
520fd3b2
...
...
@@ -436,7 +436,7 @@ class CLinker(link.Linker):
self
.
temps
=
list
(
set
(
self
.
variables
)
.
difference
(
self
.
inputs
)
.
difference
(
self
.
outputs
)
.
difference
(
self
.
orphans
))
self
.
consts
=
[]
self
.
node_order
=
fgraph
.
toposort
(
)
self
.
node_order
=
self
.
schedule
(
fgraph
)
def
code_gen
(
self
):
"""WRITEME
...
...
@@ -994,8 +994,7 @@ class CLinker(link.Linker):
c_compiler
=
self
.
c_compiler
(),
)
@staticmethod
def
cmodule_key_
(
fgraph
,
no_recycling
,
compile_args
=
None
,
libraries
=
None
,
def
cmodule_key_
(
self
,
fgraph
,
no_recycling
,
compile_args
=
None
,
libraries
=
None
,
header_dirs
=
None
,
insert_config_md5
=
True
,
c_compiler
=
None
):
"""
Do the actual computation of cmodule_key in a static method
...
...
@@ -1007,7 +1006,7 @@ class CLinker(link.Linker):
libraries
=
[]
if
header_dirs
is
None
:
header_dirs
=
[]
order
=
list
(
fgraph
.
toposort
()
)
order
=
self
.
schedule
(
fgraph
)
#set of variables that have been computed by nodes we have
# seen 'so far' in the loop below
fgraph_computed_set
=
set
()
...
...
@@ -1430,7 +1429,7 @@ class OpWiseCLinker(link.LocalLinker):
try
:
fgraph
=
self
.
fgraph
order
=
fgraph
.
toposort
(
)
order
=
self
.
schedule
(
fgraph
)
no_recycling
=
self
.
no_recycling
input_storage
,
output_storage
,
storage_map
=
link
.
map_storage
(
...
...
theano/gof/link.py
浏览文件 @
520fd3b2
...
...
@@ -52,6 +52,7 @@ def thunk_hook(type, value, trace):
sys
.
excepthook
=
thunk_hook
# TODO: Make this work with linker defined schedule
def
raise_with_op
(
op
,
exc_info
=
None
):
"""
Re-raise an exception while annotating the exception object with
...
...
@@ -173,6 +174,8 @@ class Linker(object):
return
execute
def
schedule
(
self
,
fgraph
):
return
fgraph
.
toposort
()
#TODO: Move this class to the compile module, where it is used (and for which it exists).
class
Container
(
object
):
...
...
@@ -414,7 +417,7 @@ class PerformLinker(LocalLinker):
"""WRITEME
Basic L{Linker} subclass that calls the perform method on each L{Op} in
the L{FunctionGraph} in the order given by L{
FunctionGraph.toposort
}.
the L{FunctionGraph} in the order given by L{
Linker.schedule
}.
"""
def
__init__
(
self
,
allow_gc
=
True
):
...
...
@@ -449,7 +452,7 @@ class PerformLinker(LocalLinker):
"""
fgraph
=
self
.
fgraph
order
=
list
(
fgraph
.
toposort
()
)
order
=
self
.
schedule
(
fgraph
)
no_recycling
=
self
.
no_recycling
input_storage
,
output_storage
,
storage_map
=
map_storage
(
fgraph
,
order
,
input_storage
,
output_storage
)
...
...
theano/gof/vm.py
浏览文件 @
520fd3b2
...
...
@@ -780,7 +780,7 @@ class VM_Linker(link.LocalLinker):
output_storage
=
None
,
):
fgraph
=
self
.
fgraph
order
=
list
(
fgraph
.
toposort
()
)
order
=
self
.
schedule
(
fgraph
)
no_recycling
=
self
.
no_recycling
input_storage
,
output_storage
,
storage_map
=
link
.
map_storage
(
...
...
theano/scan_module/scan_op.py
浏览文件 @
520fd3b2
...
...
@@ -184,7 +184,7 @@ class Scan(PureOp):
tmp_in
,
tmp_out
=
scan_utils
.
reconstruct_graph
(
self
.
inputs
,
self
.
outputs
)
local_fgraph
=
gof
.
FunctionGraph
(
tmp_in
,
tmp_out
)
self
.
_cmodule_key
=
gof
.
CLinker
.
cmodule_key_
(
local_fgraph
,
[])
self
.
_cmodule_key
=
gof
.
CLinker
()
.
cmodule_key_
(
local_fgraph
,
[])
self
.
_hash_inner_graph
=
hash
(
self
.
_cmodule_key
)
else
:
self
.
_hash_inner_graph
=
self
.
info
[
'gpu_hash'
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论