Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1d8302e5
提交
1d8302e5
authored
9月 09, 2014
作者:
Dustin Webb
提交者:
Frederic
9月 11, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reworked register_stabilize to work like register_canonicalize and register_specialize.
上级
f018f34a
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
11 行增加
和
9 行删除
+11
-9
nnet.py
theano/tensor/nnet/nnet.py
+1
-2
opt.py
theano/tensor/opt.py
+10
-7
没有找到文件。
theano/tensor/nnet/nnet.py
浏览文件 @
1d8302e5
...
@@ -1330,6 +1330,7 @@ class CrossentropyCategorical1Hot(gof.Op):
...
@@ -1330,6 +1330,7 @@ class CrossentropyCategorical1Hot(gof.Op):
crossentropy_categorical_1hot
=
CrossentropyCategorical1Hot
()
crossentropy_categorical_1hot
=
CrossentropyCategorical1Hot
()
@opt.register_stabilize
(
'gpu'
)
@opt.register_specialize
(
'gpu'
)
@opt.register_specialize
(
'gpu'
)
@gof.optimizer
@gof.optimizer
def
crossentropy_to_crossentropy_with_softmax_with_bias
(
fgraph
):
def
crossentropy_to_crossentropy_with_softmax_with_bias
(
fgraph
):
...
@@ -1358,8 +1359,6 @@ def crossentropy_to_crossentropy_with_softmax_with_bias(fgraph):
...
@@ -1358,8 +1359,6 @@ def crossentropy_to_crossentropy_with_softmax_with_bias(fgraph):
while
search_make_one_sub
():
while
search_make_one_sub
():
pass
pass
return
return
opt
.
register_stabilize
(
crossentropy_to_crossentropy_with_softmax_with_bias
,
'gpu'
)
@gof.optimizer
@gof.optimizer
...
...
theano/tensor/opt.py
浏览文件 @
1d8302e5
...
@@ -321,6 +321,11 @@ def register_canonicalize(lopt, *tags, **kwargs):
...
@@ -321,6 +321,11 @@ def register_canonicalize(lopt, *tags, **kwargs):
def
register_stabilize
(
lopt
,
*
tags
,
**
kwargs
):
def
register_stabilize
(
lopt
,
*
tags
,
**
kwargs
):
if
type
(
lopt
)
==
str
:
def
register
(
inner_lopt
):
return
register_stabilize
(
inner_lopt
,
*
tags
,
**
kwargs
)
return
register
else
:
name
=
(
kwargs
and
kwargs
.
pop
(
'name'
))
or
lopt
.
__name__
name
=
(
kwargs
and
kwargs
.
pop
(
'name'
))
or
lopt
.
__name__
compile
.
optdb
[
'stabilize'
]
.
register
(
name
,
lopt
,
'fast_run'
,
*
tags
)
compile
.
optdb
[
'stabilize'
]
.
register
(
name
,
lopt
,
'fast_run'
,
*
tags
)
return
lopt
return
lopt
...
@@ -4161,6 +4166,8 @@ def attempt_distribution(factor, num, denum, out_type):
...
@@ -4161,6 +4166,8 @@ def attempt_distribution(factor, num, denum, out_type):
neg_pairs
))),
num
,
denum
neg_pairs
))),
num
,
denum
@register_canonicalize
@register_stabilize
@gof.local_optimizer
([
T
.
mul
,
T
.
true_div
,
T
.
inv
])
@gof.local_optimizer
([
T
.
mul
,
T
.
true_div
,
T
.
inv
])
def
local_greedy_distributor
(
node
):
def
local_greedy_distributor
(
node
):
"""
"""
...
@@ -4225,10 +4232,10 @@ def local_greedy_distributor(node):
...
@@ -4225,10 +4232,10 @@ def local_greedy_distributor(node):
return
[
rval
]
return
[
rval
]
register_canonicalize
(
local_greedy_distributor
)
register_stabilize
(
local_greedy_distributor
)
@register_canonicalize
(
'fast_compile'
)
@register_stabilize
(
'fast_compile'
)
@register_specialize
(
'fast_compile'
)
@gof.local_optimizer
(
None
)
@gof.local_optimizer
(
None
)
def
constant_folding
(
node
):
def
constant_folding
(
node
):
for
input
in
node
.
inputs
:
for
input
in
node
.
inputs
:
...
@@ -4262,10 +4269,6 @@ def constant_folding(node):
...
@@ -4262,10 +4269,6 @@ def constant_folding(node):
rval
.
append
(
constant
(
output
.
type
,
storage_map
[
output
][
0
]))
rval
.
append
(
constant
(
output
.
type
,
storage_map
[
output
][
0
]))
return
rval
return
rval
register_canonicalize
(
constant_folding
,
'fast_compile'
)
register_stabilize
(
constant_folding
,
'fast_compile'
)
register_specialize
(
constant_folding
,
'fast_compile'
)
def
_is_1
(
expr
):
def
_is_1
(
expr
):
"""rtype bool. True iff expr is a constant close to 1
"""rtype bool. True iff expr is a constant close to 1
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论