Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
edf974b4
提交
edf974b4
authored
11月 18, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow opt registered in name EquilibriumDB to do not be enable by the…
Allow opt registered in name EquilibriumDB to do not be enable by the EquilibrumDB name and use that for local_remove_all_assert opt.
上级
7c71f3ad
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
25 行增加
和
4 行删除
+25
-4
optdb.py
theano/gof/optdb.py
+23
-2
opt.py
theano/tensor/opt.py
+2
-2
没有找到文件。
theano/gof/optdb.py
浏览文件 @
edf974b4
...
@@ -32,7 +32,21 @@ class DB(object):
...
@@ -32,7 +32,21 @@ class DB(object):
self
.
name
=
None
# will be reset by register
self
.
name
=
None
# will be reset by register
#(via obj.name by the thing doing the registering)
#(via obj.name by the thing doing the registering)
def
register
(
self
,
name
,
obj
,
*
tags
):
def
register
(
self
,
name
,
obj
,
*
tags
,
**
kwargs
):
"""
:param name: name of the optimizer.
:param obj: the optimizer to register.
:param tags: tag name that allow to select the optimizer.
:param kwargs: If non empty, should contain
only use_db_name_as_tag=False.
By default, all optimizations registered in EquilibriumDB
are selected when the EquilibriumDB name is used as a
tag. We do not want this behavior for some optimizer like
local_remove_all_assert. use_db_name_as_tag=False remove
that behavior. This mean only the optimizer name and the
tags specified will enable that optimization.
"""
# N.B. obj is not an instance of class Optimizer.
# N.B. obj is not an instance of class Optimizer.
# It is an instance of a DB.In the tests for example,
# It is an instance of a DB.In the tests for example,
# this is not always the case.
# this is not always the case.
...
@@ -42,7 +56,10 @@ class DB(object):
...
@@ -42,7 +56,10 @@ class DB(object):
raise
ValueError
(
'The name of the object cannot be an existing'
raise
ValueError
(
'The name of the object cannot be an existing'
' tag or the name of another existing object.'
,
' tag or the name of another existing object.'
,
obj
,
name
)
obj
,
name
)
if
kwargs
:
assert
"use_db_name_as_tag"
in
kwargs
assert
kwargs
[
"use_db_name_as_tag"
]
is
False
else
:
if
self
.
name
is
not
None
:
if
self
.
name
is
not
None
:
tags
=
tags
+
(
self
.
name
,)
tags
=
tags
+
(
self
.
name
,)
obj
.
name
=
name
obj
.
name
=
name
...
@@ -155,6 +172,10 @@ class Query(object):
...
@@ -155,6 +172,10 @@ class Query(object):
if
isinstance
(
self
.
exclude
,
(
list
,
tuple
)):
if
isinstance
(
self
.
exclude
,
(
list
,
tuple
)):
self
.
exclude
=
OrderedSet
(
self
.
exclude
)
self
.
exclude
=
OrderedSet
(
self
.
exclude
)
def
__str__
(
self
):
return
"Query{inc=
%
s,ex=
%
s,require=
%
s,subquery=
%
s,position_cutoff=
%
d}"
%
(
self
.
include
,
self
.
exclude
,
self
.
require
,
self
.
subquery
,
self
.
position_cutoff
)
#add all opt with this tag
#add all opt with this tag
def
including
(
self
,
*
tags
):
def
including
(
self
,
*
tags
):
return
Query
(
self
.
include
.
union
(
tags
),
return
Query
(
self
.
include
.
union
(
tags
),
...
...
theano/tensor/opt.py
浏览文件 @
edf974b4
...
@@ -1596,8 +1596,8 @@ def local_remove_all_assert(node):
...
@@ -1596,8 +1596,8 @@ def local_remove_all_assert(node):
return
[
node
.
inputs
[
0
]]
return
[
node
.
inputs
[
0
]]
# Disabled by default
# Disabled by default
compile
.
optdb
[
'canonicalize'
]
.
register
(
'local_remove_all_assert'
,
compile
.
optdb
[
'canonicalize'
]
.
register
(
'local_remove_all_assert'
,
local_remove_all_assert
)
local_remove_all_assert
,
use_db_name_as_tag
=
False
)
@register_specialize
@register_specialize
@gof.local_optimizer
([
T
.
Elemwise
])
@gof.local_optimizer
([
T
.
Elemwise
])
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论