Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
cc916435
提交
cc916435
authored
6月 04, 2008
作者:
Olivier Breuleux
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
linker.accept returns a copy if the linker already serves an env
上级
1dabbb54
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
15 行增加
和
8 行删除
+15
-8
cc.py
gof/cc.py
+6
-3
link.py
gof/link.py
+9
-5
没有找到文件。
gof/cc.py
浏览文件 @
cc916435
...
@@ -344,7 +344,8 @@ class CLinker(link.Linker):
...
@@ -344,7 +344,8 @@ class CLinker(link.Linker):
def
accept
(
self
,
env
,
no_recycling
=
[]):
def
accept
(
self
,
env
,
no_recycling
=
[]):
if
self
.
env
is
not
None
and
self
.
env
is
not
env
:
if
self
.
env
is
not
None
and
self
.
env
is
not
env
:
raise
Exception
(
"Cannot accept from a Linker that is already tied to another Env."
)
return
type
(
self
)()
.
accept
(
env
,
no_recycling
)
#raise Exception("Cannot accept from a Linker that is already tied to another Env.")
self
.
env
=
env
self
.
env
=
env
self
.
fetch_results
()
self
.
fetch_results
()
self
.
no_recycling
=
no_recycling
self
.
no_recycling
=
no_recycling
...
@@ -783,7 +784,8 @@ class OpWiseCLinker(link.LocalLinker):
...
@@ -783,7 +784,8 @@ class OpWiseCLinker(link.LocalLinker):
def
accept
(
self
,
env
,
no_recycling
=
[]):
def
accept
(
self
,
env
,
no_recycling
=
[]):
if
self
.
env
is
not
None
and
self
.
env
is
not
env
:
if
self
.
env
is
not
None
and
self
.
env
is
not
env
:
raise
Exception
(
"Cannot accept from a Linker that is already tied to another Env."
)
return
type
(
self
)(
self
.
fallback_on_perform
)
.
accept
(
env
,
no_recycling
)
#raise Exception("Cannot accept from a Linker that is already tied to another Env.")
self
.
env
=
env
self
.
env
=
env
self
.
no_recycling
=
no_recycling
self
.
no_recycling
=
no_recycling
return
self
return
self
...
@@ -883,7 +885,8 @@ class DualLinker(link.Linker):
...
@@ -883,7 +885,8 @@ class DualLinker(link.Linker):
def
accept
(
self
,
env
,
no_recycling
=
[]):
def
accept
(
self
,
env
,
no_recycling
=
[]):
if
self
.
env
is
not
None
and
self
.
env
is
not
env
:
if
self
.
env
is
not
None
and
self
.
env
is
not
env
:
raise
Exception
(
"Cannot accept from a Linker that is already tied to another Env."
)
return
type
(
self
)(
self
.
checker
)
.
accept
(
env
,
no_recycling
)
#raise Exception("Cannot accept from a Linker that is already tied to another Env.")
self
.
env
=
env
self
.
env
=
env
self
.
no_recycling
=
no_recycling
self
.
no_recycling
=
no_recycling
return
self
return
self
...
...
gof/link.py
浏览文件 @
cc916435
...
@@ -44,7 +44,7 @@ def raise_with_op(op, exc_info = None):
...
@@ -44,7 +44,7 @@ def raise_with_op(op, exc_info = None):
raise
exc_type
,
exc_value
,
exc_trace
raise
exc_type
,
exc_value
,
exc_trace
class
Linker
:
class
Linker
(
object
)
:
def
make_thunk
(
self
):
def
make_thunk
(
self
):
"""
"""
...
@@ -219,7 +219,8 @@ class PerformLinker(LocalLinker):
...
@@ -219,7 +219,8 @@ class PerformLinker(LocalLinker):
def
accept
(
self
,
env
,
no_recycling
=
[]):
def
accept
(
self
,
env
,
no_recycling
=
[]):
if
self
.
env
is
not
None
and
self
.
env
is
not
env
:
if
self
.
env
is
not
None
and
self
.
env
is
not
env
:
raise
Exception
(
"Cannot accept from a Linker that is already tied to another Env."
)
return
type
(
self
)()
.
accept
(
env
,
no_recycling
)
#raise Exception("Cannot accept from a Linker that is already tied to another Env.")
self
.
env
=
env
self
.
env
=
env
self
.
no_recycling
=
no_recycling
self
.
no_recycling
=
no_recycling
return
self
return
self
...
@@ -292,6 +293,7 @@ class WrapLinker(Linker):
...
@@ -292,6 +293,7 @@ class WrapLinker(Linker):
function.)
function.)
"""
"""
self
.
env
=
None
self
.
linkers
=
linkers
self
.
linkers
=
linkers
self
.
wrapper
=
wrapper
self
.
wrapper
=
wrapper
...
@@ -307,10 +309,12 @@ class WrapLinker(Linker):
...
@@ -307,10 +309,12 @@ class WrapLinker(Linker):
the computation to avoid reusing it.
the computation to avoid reusing it.
"""
"""
if
self
.
env
is
not
None
and
self
.
env
is
not
env
:
return
type
(
self
)(
self
.
linkers
,
self
.
wrapper
)
.
accept
(
env
,
no_recycling
)
self
.
env
=
env
self
.
env
=
env
self
.
no_recycling
=
no_recycling
self
.
no_recycling
=
no_recycling
for
l
in
self
.
linkers
:
self
.
linkers
=
[
linker
.
accept
(
env
,
no_recycling
)
for
linker
in
self
.
linkers
]
l
.
accept
(
env
,
no_recycling
)
return
self
return
self
def
pre
(
self
,
f
,
inputs
,
order
,
thunk_groups
):
def
pre
(
self
,
f
,
inputs
,
order
,
thunk_groups
):
...
@@ -350,7 +354,7 @@ class WrapLinker(Linker):
...
@@ -350,7 +354,7 @@ class WrapLinker(Linker):
input2
.
storage
[
0
]
=
copy
(
input1
.
storage
[
0
])
input2
.
storage
[
0
]
=
copy
(
input1
.
storage
[
0
])
for
x
in
to_reset
:
for
x
in
to_reset
:
x
[
0
]
=
None
x
[
0
]
=
None
pre
(
f
,
[
input
.
data
for
input
in
input_lists
[
0
]],
order
,
thunk_groups
)
pre
(
sel
f
,
[
input
.
data
for
input
in
input_lists
[
0
]],
order
,
thunk_groups
)
for
i
,
(
thunks
,
node
)
in
enumerate
(
zip
(
thunk_groups
,
order
)):
for
i
,
(
thunks
,
node
)
in
enumerate
(
zip
(
thunk_groups
,
order
)):
try
:
try
:
wrapper
(
i
,
node
,
*
thunks
)
wrapper
(
i
,
node
,
*
thunks
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论