Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
df09663a
提交
df09663a
authored
11月 21, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make FunctionGraph feature classes inherit from the Feature class
上级
d0e4dfc1
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
19 行删除
+12
-19
opt.py
theano/gof/opt.py
+11
-18
opt.py
theano/tensor/opt.py
+1
-1
没有找到文件。
theano/gof/opt.py
浏览文件 @
df09663a
...
...
@@ -21,8 +21,9 @@ import numpy as np
import
theano
from
theano
import
config
from
theano.gof
import
graph
,
op
,
toolbox
,
unify
from
theano.gof
import
graph
,
op
,
unify
from
theano.gof.fg
import
InconsistencyError
from
theano.gof.toolbox
import
Feature
,
NodeFinder
from
theano.gof.utils
import
AssocList
,
flatten
from
theano.misc.ordered_set
import
OrderedSet
...
...
@@ -451,12 +452,11 @@ class SeqOptimizer(GlobalOptimizer, UserList):
)
class
MergeFeature
:
"""
Keeps track of variables in fgraph that cannot be merged together.
class
MergeFeature
(
Feature
):
"""Keeps track of variables in a `FunctionGraph` that cannot be merged together.
That way, the
MergeOptimizer can remember the result of the last merge
pass on the fgraph
.
That way, the
`MergeOptimizer` can remember the result of the last
merge-pass on the `FunctionGraph`
.
"""
...
...
@@ -1815,14 +1815,7 @@ class PatternSub(LocalOptimizer):
)
##################
# Navigators #
##################
# Use the following classes to apply LocalOptimizers
class
Updater
:
class
Updater
(
Feature
):
def
__init__
(
self
,
importer
,
pruner
,
chin
,
name
=
None
):
self
.
importer
=
importer
self
.
pruner
=
pruner
...
...
@@ -2070,7 +2063,7 @@ class NavigatorOptimizer(GlobalOptimizer):
def
add_requirements
(
self
,
fgraph
):
super
()
.
add_requirements
(
fgraph
)
# Added by default
# fgraph.attach_feature(
toolbox.
ReplaceValidate())
# fgraph.attach_feature(ReplaceValidate())
if
self
.
local_opt
:
self
.
local_opt
.
add_requirements
(
fgraph
)
...
...
@@ -2284,10 +2277,10 @@ class OpKeyOptimizer(NavigatorOptimizer):
"""
super
()
.
add_requirements
(
fgraph
)
fgraph
.
attach_feature
(
toolbox
.
NodeFinder
())
fgraph
.
attach_feature
(
NodeFinder
())
class
ChangeTracker
:
class
ChangeTracker
(
Feature
)
:
def
__init__
(
self
):
self
.
changed
=
False
self
.
nb_imported
=
0
...
...
@@ -3197,7 +3190,7 @@ def check_stack_trace(f_or_fgraph, ops_to_check="last", bug_print="raise"):
return
True
class
CheckStackTraceFeature
:
class
CheckStackTraceFeature
(
Feature
)
:
def
on_import
(
self
,
fgraph
,
node
,
reason
):
# In optdb we only register the CheckStackTraceOptimization when
# theano.config.check_stack_trace is not off but we also double check here.
...
...
theano/tensor/opt.py
浏览文件 @
df09663a
...
...
@@ -982,7 +982,7 @@ class MakeVectorPrinter:
tt
.
pprint
.
assign
(
MakeVector
,
MakeVectorPrinter
())
class
ShapeFeature
:
class
ShapeFeature
(
toolbox
.
Feature
)
:
"""Graph optimizer for removing all calls to shape().
This optimizer replaces all Shapes and Subtensors of Shapes with
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论