Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f1ce6f5d
提交
f1ce6f5d
authored
2月 14, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
2月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename opt alias to aesara_opt in aesara.graph.optdb
上级
5e8398b5
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
14 行增加
和
9 行删除
+14
-9
optdb.py
aesara/graph/optdb.py
+14
-9
没有找到文件。
aesara/graph/optdb.py
浏览文件 @
f1ce6f5d
...
@@ -6,12 +6,12 @@ from io import StringIO
...
@@ -6,12 +6,12 @@ from io import StringIO
from
typing
import
Dict
,
Optional
,
Sequence
,
Union
from
typing
import
Dict
,
Optional
,
Sequence
,
Union
from
aesara.configdefaults
import
config
from
aesara.configdefaults
import
config
from
aesara.graph
import
opt
from
aesara.graph
import
opt
as
aesara_opt
from
aesara.misc.ordered_set
import
OrderedSet
from
aesara.misc.ordered_set
import
OrderedSet
from
aesara.utils
import
DefaultOrderedDict
from
aesara.utils
import
DefaultOrderedDict
OptimizersType
=
Union
[
opt
.
GlobalOptimizer
,
opt
.
LocalOptimizer
]
OptimizersType
=
Union
[
aesara_opt
.
GlobalOptimizer
,
aesara_
opt
.
LocalOptimizer
]
class
OptimizationDatabase
:
class
OptimizationDatabase
:
...
@@ -58,7 +58,12 @@ class OptimizationDatabase:
...
@@ -58,7 +58,12 @@ class OptimizationDatabase:
"""
"""
if
not
isinstance
(
if
not
isinstance
(
optimizer
,
(
OptimizationDatabase
,
opt
.
GlobalOptimizer
,
opt
.
LocalOptimizer
)
optimizer
,
(
OptimizationDatabase
,
aesara_opt
.
GlobalOptimizer
,
aesara_opt
.
LocalOptimizer
,
),
):
):
raise
TypeError
(
f
"{optimizer} is not a valid optimizer type."
)
raise
TypeError
(
f
"{optimizer} is not a valid optimizer type."
)
...
@@ -357,12 +362,12 @@ class EquilibriumDB(OptimizationDatabase):
...
@@ -357,12 +362,12 @@ class EquilibriumDB(OptimizationDatabase):
final_opts
=
None
final_opts
=
None
if
len
(
cleanup_opts
)
==
0
:
if
len
(
cleanup_opts
)
==
0
:
cleanup_opts
=
None
cleanup_opts
=
None
return
opt
.
EquilibriumOptimizer
(
return
aesara_
opt
.
EquilibriumOptimizer
(
opts
,
opts
,
max_use_ratio
=
config
.
optdb__max_use_ratio
,
max_use_ratio
=
config
.
optdb__max_use_ratio
,
ignore_newtrees
=
self
.
ignore_newtrees
,
ignore_newtrees
=
self
.
ignore_newtrees
,
tracks_on_change_inputs
=
self
.
tracks_on_change_inputs
,
tracks_on_change_inputs
=
self
.
tracks_on_change_inputs
,
failure_callback
=
opt
.
NavigatorOptimizer
.
warn_inplace
,
failure_callback
=
aesara_
opt
.
NavigatorOptimizer
.
warn_inplace
,
final_optimizers
=
final_opts
,
final_optimizers
=
final_opts
,
cleanup_optimizers
=
cleanup_opts
,
cleanup_optimizers
=
cleanup_opts
,
)
)
...
@@ -382,9 +387,9 @@ class SequenceDB(OptimizationDatabase):
...
@@ -382,9 +387,9 @@ class SequenceDB(OptimizationDatabase):
"""
"""
seq_opt
=
opt
.
SeqOptimizer
seq_opt
=
aesara_
opt
.
SeqOptimizer
def
__init__
(
self
,
failure_callback
=
opt
.
SeqOptimizer
.
warn
):
def
__init__
(
self
,
failure_callback
=
aesara_
opt
.
SeqOptimizer
.
warn
):
super
()
.
__init__
()
super
()
.
__init__
()
self
.
__position__
=
{}
self
.
__position__
=
{}
self
.
failure_callback
=
failure_callback
self
.
failure_callback
=
failure_callback
...
@@ -488,7 +493,7 @@ class LocalGroupDB(SequenceDB):
...
@@ -488,7 +493,7 @@ class LocalGroupDB(SequenceDB):
self
,
self
,
apply_all_opts
:
bool
=
False
,
apply_all_opts
:
bool
=
False
,
profile
:
bool
=
False
,
profile
:
bool
=
False
,
local_opt
=
opt
.
LocalOptGroup
,
local_opt
=
aesara_
opt
.
LocalOptGroup
,
):
):
super
()
.
__init__
(
failure_callback
=
None
)
super
()
.
__init__
(
failure_callback
=
None
)
self
.
apply_all_opts
=
apply_all_opts
self
.
apply_all_opts
=
apply_all_opts
...
@@ -520,7 +525,7 @@ class TopoDB(OptimizationDatabase):
...
@@ -520,7 +525,7 @@ class TopoDB(OptimizationDatabase):
self
.
failure_callback
=
failure_callback
self
.
failure_callback
=
failure_callback
def
query
(
self
,
*
tags
,
**
kwtags
):
def
query
(
self
,
*
tags
,
**
kwtags
):
return
opt
.
TopoOptimizer
(
return
aesara_
opt
.
TopoOptimizer
(
self
.
db
.
query
(
*
tags
,
**
kwtags
),
self
.
db
.
query
(
*
tags
,
**
kwtags
),
self
.
order
,
self
.
order
,
self
.
ignore_newtrees
,
self
.
ignore_newtrees
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论