Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
df0a6370
提交
df0a6370
authored
6月 21, 2012
作者:
Nicolas Bouchard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify imports
上级
f0f898b2
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
2 行删除
+10
-2
opt.py
theano/sparse/opt.py
+10
-2
没有找到文件。
theano/sparse/opt.py
浏览文件 @
df0a6370
from
itertools
import
izip
from
itertools
import
izip
import
theano
import
theano
from
theano
import
gof
import
numpy
from
theano
import
gof
,
scalar
from
theano.sparse
import
(
CSC
,
CSR
,
csm_properties
,
Remove0
,
from
theano.sparse
import
(
CSC
,
CSR
,
csm_properties
,
Remove0
,
register_specialize
,
register_specialize
,
csm_grad
,
csm_grad_c
,
csm_grad
,
csm_grad_c
,
usmm_csc_dense
,
usmm
)
usmm_csc_dense
,
usmm
)
from
basic
import
(
_structured_dot
,
_dot
)
from
basic
import
(
_structured_dot
,
_dot
,
_is_sparse_variable
,
usmm_csc_dense_inplace
)
# This is tested in tests/test_basic.py:UsmmTests
local_usmm
=
gof
.
opt
.
PatternSub
(
local_usmm
=
gof
.
opt
.
PatternSub
(
(
theano
.
tensor
.
sub
,
'z'
,
(
theano
.
tensor
.
sub
,
'z'
,
(
theano
.
tensor
.
mul
,
(
theano
.
tensor
.
mul
,
...
@@ -29,6 +32,7 @@ def local_csm_grad_c(node):
...
@@ -29,6 +32,7 @@ def local_csm_grad_c(node):
register_specialize
(
local_csm_grad_c
)
register_specialize
(
local_csm_grad_c
)
# This is tested in tests/test_opt.py:test_local_csm_properties_csm
@gof.local_optimizer
([
csm_properties
])
@gof.local_optimizer
([
csm_properties
])
def
local_csm_properties_csm
(
node
):
def
local_csm_properties_csm
(
node
):
"""if we find csm_properties(CSM(*args)), then we can replace that with the
"""if we find csm_properties(CSM(*args)), then we can replace that with the
...
@@ -46,6 +50,7 @@ def local_csm_properties_csm(node):
...
@@ -46,6 +50,7 @@ def local_csm_properties_csm(node):
register_specialize
(
local_csm_properties_csm
)
register_specialize
(
local_csm_properties_csm
)
# This is tested in tests/test_basic.py:test_remove0
@gof.local_optimizer
([
None
])
@gof.local_optimizer
([
None
])
def
local_inplace_remove0
(
node
):
def
local_inplace_remove0
(
node
):
"""
"""
...
@@ -63,6 +68,7 @@ theano.compile.optdb.register('local_inplace_remove0',
...
@@ -63,6 +68,7 @@ theano.compile.optdb.register('local_inplace_remove0',
# register a specialization to replace StructuredDot -> StructuredDotCSx
# register a specialization to replace StructuredDot -> StructuredDotCSx
# This is tested in tests/test_basic.py:792
@gof.local_optimizer
([
_structured_dot
])
@gof.local_optimizer
([
_structured_dot
])
def
local_structured_dot
(
node
):
def
local_structured_dot
(
node
):
if
node
.
op
==
_structured_dot
:
if
node
.
op
==
_structured_dot
:
...
@@ -84,6 +90,7 @@ def local_structured_dot(node):
...
@@ -84,6 +90,7 @@ def local_structured_dot(node):
#register_specialize(local_structured_dot)
#register_specialize(local_structured_dot)
# This is tested in tests/test_basic.py:UsmmTests
@gof.local_optimizer
([
usmm_csc_dense
])
@gof.local_optimizer
([
usmm_csc_dense
])
def
local_usmm_csc_dense_inplace
(
node
):
def
local_usmm_csc_dense_inplace
(
node
):
if
node
.
op
==
usmm_csc_dense
:
if
node
.
op
==
usmm_csc_dense
:
...
@@ -91,6 +98,7 @@ def local_usmm_csc_dense_inplace(node):
...
@@ -91,6 +98,7 @@ def local_usmm_csc_dense_inplace(node):
register_specialize
(
local_usmm_csc_dense_inplace
,
'inplace'
)
register_specialize
(
local_usmm_csc_dense_inplace
,
'inplace'
)
# This is tested in tests/test_basic.py:UsmmTests
@gof.local_optimizer
([
usmm
])
@gof.local_optimizer
([
usmm
])
def
local_usmm_csx
(
node
):
def
local_usmm_csx
(
node
):
""" usmm -> usmm_csc_dense """
""" usmm -> usmm_csc_dense """
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论