Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
103e33d5
提交
103e33d5
authored
6月 21, 2024
作者:
Virgile Andreani
提交者:
Ricardo Vieira
7月 03, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove OrderedDict in graph/destroyhandler
上级
cfc3d4b6
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
12 行增加
和
16 行删除
+12
-16
destroyhandler.py
pytensor/graph/destroyhandler.py
+12
-16
没有找到文件。
pytensor/graph/destroyhandler.py
浏览文件 @
103e33d5
...
...
@@ -5,7 +5,7 @@ and inplace operations.
"""
import
itertools
from
collections
import
OrderedDict
,
deque
from
collections
import
deque
import
pytensor
from
pytensor.configdefaults
import
config
...
...
@@ -306,7 +306,7 @@ class DestroyHandler(Bookkeeper):
TODO: change name to var_to_vroot.
"""
self
.
droot
=
OrderedDict
()
self
.
droot
=
{}
"""
Maps a variable to all variables that are indirect or direct views of it
...
...
@@ -317,7 +317,7 @@ class DestroyHandler(Bookkeeper):
TODO: rename to x_to_views after reverse engineering what x is
"""
self
.
impact
=
OrderedDict
()
self
.
impact
=
{}
"""
If a var is destroyed, then this dict will map
...
...
@@ -325,11 +325,11 @@ class DestroyHandler(Bookkeeper):
TODO: rename to vroot_to_destroyer
"""
self
.
root_destroyer
=
OrderedDict
()
self
.
root_destroyer
=
{}
if
algo
is
None
:
algo
=
config
.
cycle_detection
self
.
algo
=
algo
self
.
fail_validate
=
OrderedDict
()
self
.
fail_validate
=
{}
def
clone
(
self
):
return
type
(
self
)(
self
.
do_imports_on_attach
,
self
.
algo
)
...
...
@@ -370,7 +370,7 @@ class DestroyHandler(Bookkeeper):
self
.
view_i
=
{}
# variable -> variable used in calculation
self
.
view_o
=
{}
# variable -> set of variables that use this one as a direct input
# clients: how many times does an apply use a given variable
self
.
clients
=
OrderedDict
()
# variable -> apply -> ninputs
self
.
clients
=
{}
# variable -> apply -> ninputs
self
.
stale_droot
=
True
self
.
debug_all_apps
=
set
()
...
...
@@ -527,11 +527,11 @@ class DestroyHandler(Bookkeeper):
# update self.clients
for
i
,
input
in
enumerate
(
app
.
inputs
):
self
.
clients
.
setdefault
(
input
,
OrderedDict
()
)
.
setdefault
(
app
,
0
)
self
.
clients
.
setdefault
(
input
,
{}
)
.
setdefault
(
app
,
0
)
self
.
clients
[
input
][
app
]
+=
1
for
i
,
output
in
enumerate
(
app
.
outputs
):
self
.
clients
.
setdefault
(
output
,
OrderedDict
()
)
self
.
clients
.
setdefault
(
output
,
{}
)
self
.
stale_droot
=
True
...
...
@@ -591,7 +591,7 @@ class DestroyHandler(Bookkeeper):
if
self
.
clients
[
old_r
][
app
]
==
0
:
del
self
.
clients
[
old_r
][
app
]
self
.
clients
.
setdefault
(
new_r
,
OrderedDict
()
)
.
setdefault
(
app
,
0
)
self
.
clients
.
setdefault
(
new_r
,
{}
)
.
setdefault
(
app
,
0
)
self
.
clients
[
new_r
][
app
]
+=
1
# UPDATE self.view_i, self.view_o
...
...
@@ -632,7 +632,7 @@ class DestroyHandler(Bookkeeper):
if
self
.
algo
==
"fast"
:
if
self
.
fail_validate
:
app_err_pairs
=
self
.
fail_validate
self
.
fail_validate
=
OrderedDict
()
self
.
fail_validate
=
{}
# self.fail_validate can only be a hint that maybe/probably
# there is a cycle.This is because inside replace() we could
# record many reasons to not accept a change, but we don't
...
...
@@ -674,12 +674,8 @@ class DestroyHandler(Bookkeeper):
c) an Apply destroys (illegally) one of its own inputs by aliasing
"""
if
ordered
:
set_type
=
OrderedSet
rval
=
OrderedDict
()
else
:
set_type
=
set
rval
=
dict
()
set_type
=
OrderedSet
if
ordered
else
set
rval
=
{}
if
self
.
destroyers
:
# BUILD DATA STRUCTURES
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论