Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a8be57e6
提交
a8be57e6
authored
8月 28, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add the optimization tag cxx_only.
This tag tell that an optimization will insert Op with c code only. We don't want to run that optimization then there is no c compiler.
上级
7c8e8312
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
17 行增加
和
9 行删除
+17
-9
optimization.txt
doc/extending/optimization.txt
+4
-0
mode.py
theano/compile/mode.py
+6
-3
opt.py
theano/sparse/opt.py
+7
-6
没有找到文件。
doc/extending/optimization.txt
浏览文件 @
a8be57e6
...
...
@@ -19,7 +19,11 @@ In this section we will define a couple optimizations on doubles.
Later, the rest is more useful for when that decorator syntax type thing
doesn't work. (There are optimizations that don't fit that model).
.. note::
There is the optimization tag `cxx_only` that tell this
optimization will insert Op that only have c code. So we should not
run them when we don't have a c++ compiler.
Global and local optimizations
==============================
...
...
theano/compile/mode.py
浏览文件 @
a8be57e6
...
...
@@ -83,10 +83,13 @@ def register_linker(name, linker):
# If a string is passed as the optimizer argument in the constructor
# for Mode, it will be used as the key to retrieve the real optimizer
# in this dictionary
OPT_FAST_RUN
=
gof
.
Query
(
include
=
[
'fast_run'
])
exclude
=
[]
if
not
theano
.
config
.
cxx
:
exclude
=
[
'cxx_only'
]
OPT_FAST_RUN
=
gof
.
Query
(
include
=
[
'fast_run'
],
exclude
=
exclude
)
OPT_FAST_RUN_STABLE
=
OPT_FAST_RUN
.
requiring
(
'stable'
)
OPT_FAST_COMPILE
=
gof
.
Query
(
include
=
[
'fast_compile'
])
OPT_STABILIZE
=
gof
.
Query
(
include
=
[
'fast_run'
])
OPT_FAST_COMPILE
=
gof
.
Query
(
include
=
[
'fast_compile'
]
,
exclude
=
exclude
)
OPT_STABILIZE
=
gof
.
Query
(
include
=
[
'fast_run'
]
,
exclude
=
exclude
)
OPT_STABILIZE
.
position_cutoff
=
1.5000001
OPT_FAST_RUN
.
name
=
'OPT_FAST_RUN'
OPT_FAST_RUN_STABLE
.
name
=
'OPT_FAST_RUN_STABLE'
...
...
theano/sparse/opt.py
浏览文件 @
a8be57e6
...
...
@@ -686,7 +686,7 @@ register_specialize(local_usmm, name="local_usmm")
def
local_usmm_csc_dense_inplace
(
node
):
if
node
.
op
==
usmm_csc_dense
:
return
[
usmm_csc_dense_inplace
(
*
node
.
inputs
)]
register_specialize
(
local_usmm_csc_dense_inplace
,
'inplace'
)
register_specialize
(
local_usmm_csc_dense_inplace
,
'
cxx_only'
,
'
inplace'
)
# This is tested in tests/test_basic.py:UsmmTests
...
...
@@ -714,7 +714,7 @@ def local_usmm_csx(node):
return
[
usmm_csc_dense
(
alpha
,
x_val
,
x_ind
,
x_ptr
,
x_nsparse
,
y
,
z
)]
return
False
sparse
.
register_specialize
(
local_usmm_csx
)
sparse
.
register_specialize
(
local_usmm_csx
,
'cxx_only'
)
class
CSMGradC
(
gof
.
Op
):
...
...
@@ -850,7 +850,7 @@ def local_csm_grad_c(node):
if
node
.
op
==
csm_grad
(
None
):
return
[
csm_grad_c
(
*
node
.
inputs
)]
return
False
register_specialize
(
local_csm_grad_c
)
register_specialize
(
local_csm_grad_c
,
'cxx_only'
)
class
MulSDCSC
(
gof
.
Op
):
...
...
@@ -1117,7 +1117,7 @@ def local_mul_s_d(node):
sparse
.
csm_shape
(
svar
))]
return
False
sparse
.
register_specialize
(
local_mul_s_d
)
sparse
.
register_specialize
(
local_mul_s_d
,
'cxx_only'
)
class
MulSVCSR
(
gof
.
Op
):
...
...
@@ -1259,7 +1259,7 @@ def local_mul_s_v(node):
return
[
CSx
(
c_data
,
s_ind
,
s_ptr
,
s_shape
)]
return
False
sparse
.
register_specialize
(
local_mul_s_v
)
sparse
.
register_specialize
(
local_mul_s_v
,
'cxx_only'
)
class
StructuredAddSVCSR
(
gof
.
Op
):
...
...
@@ -1416,7 +1416,7 @@ def local_structured_add_s_v(node):
return
[
CSx
(
c_data
,
s_ind
,
s_ptr
,
s_shape
)]
return
False
sparse
.
register_specialize
(
local_structured_add_s_v
)
sparse
.
register_specialize
(
local_structured_add_s_v
,
'cxx_only'
)
class
SamplingDotCSR
(
gof
.
Op
):
...
...
@@ -1656,4 +1656,5 @@ def local_sampling_dot_csr(node):
return
[
sparse
.
CSR
(
z_data
,
z_ind
,
z_ptr
,
p_shape
)]
return
False
sparse
.
register_specialize
(
local_sampling_dot_csr
,
'cxx_only'
,
name
=
'local_sampling_dot_csr'
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论