Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6f98d16a
提交
6f98d16a
authored
9月 27, 2012
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #963 from lamblin/fix_cxx_noblas
Fix tests when cxx is available, but not blas
上级
48e862bd
0bce24e0
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
26 行增加
和
5 行删除
+26
-5
opt.py
theano/sparse/opt.py
+6
-1
test_basic.py
theano/sparse/tests/test_basic.py
+10
-1
test_opt.py
theano/sparse/tests/test_opt.py
+7
-1
Conv3D.py
theano/tensor/nnet/Conv3D.py
+3
-2
没有找到文件。
theano/sparse/opt.py
浏览文件 @
6f98d16a
...
...
@@ -675,7 +675,8 @@ local_usmm = gof.opt.PatternSub(
(
theano
.
tensor
.
sub
,
'z'
,
(
theano
.
tensor
.
mul
,
{
'pattern'
:
'alpha'
,
'constraint'
:
lambda
expr
:
numpy
.
all
(
expr
.
type
.
broadcastable
)},
'constraint'
:
lambda
expr
:
(
numpy
.
all
(
expr
.
type
.
broadcastable
)
and
theano
.
config
.
blas
.
ldflags
)},
(
sparse
.
_dot
,
'x'
,
'y'
))),
(
usmm
,
(
theano
.
tensor
.
neg
,
'alpha'
),
'x'
,
'y'
,
'z'
))
register_specialize
(
local_usmm
,
name
=
"local_usmm"
)
...
...
@@ -1646,6 +1647,9 @@ sampling_dot_csr = SamplingDotCSR()
# register a specialization to replace SamplingDot -> SamplingDotCsr
@gof.local_optimizer
([
sparse
.
sampling_dot
])
def
local_sampling_dot_csr
(
node
):
if
not
theano
.
config
.
blas
.
ldflags
:
# The C implementation of SamplingDotCsr relies on BLAS routines
return
if
node
.
op
==
sparse
.
sampling_dot
:
x
,
y
,
p
=
node
.
inputs
if
p
.
type
.
format
==
'csr'
:
...
...
@@ -1656,6 +1660,7 @@ 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'
)
theano/sparse/tests/test_basic.py
浏览文件 @
6f98d16a
...
...
@@ -1204,7 +1204,16 @@ class UsmmTests(unittest.TestCase):
fast_compile
=
theano
.
config
.
mode
==
"FAST_COMPILE"
if
(
y
.
type
.
dtype
==
up
and
format1
==
'csc'
and
format2
==
'dense'
if
not
theano
.
config
.
blas
.
ldflags
:
# Usmm should not be inserted, because it relies on BLAS
assert
len
(
topo
)
==
4
,
topo
assert
isinstance
(
topo
[
0
]
.
op
,
theano
.
sparse
.
Dot
)
assert
isinstance
(
topo
[
1
]
.
op
,
theano
.
tensor
.
DimShuffle
)
assert
(
isinstance
(
topo
[
2
]
.
op
,
theano
.
tensor
.
Elemwise
)
and
isinstance
(
topo
[
2
]
.
op
.
scalar_op
,
theano
.
scalar
.
Mul
))
assert
(
isinstance
(
topo
[
3
]
.
op
,
theano
.
tensor
.
Elemwise
)
and
isinstance
(
topo
[
3
]
.
op
.
scalar_op
,
theano
.
scalar
.
Sub
))
elif
(
y
.
type
.
dtype
==
up
and
format1
==
'csc'
and
format2
==
'dense'
and
not
fast_compile
and
theano
.
config
.
cxx
and
up
in
(
'float32'
,
'float64'
)):
# The op UsmmCscDense should be inserted
...
...
theano/sparse/tests/test_opt.py
浏览文件 @
6f98d16a
...
...
@@ -130,5 +130,11 @@ def test_local_sampling_dot_csr():
sparse
.
sampling_dot
(
*
inputs
),
mode
=
mode
)
assert
not
any
(
isinstance
(
node
.
op
,
sparse
.
SamplingDot
)
for
node
if
theano
.
config
.
blas
.
ldflags
:
assert
not
any
(
isinstance
(
node
.
op
,
sparse
.
SamplingDot
)
for
node
in
f
.
maker
.
fgraph
.
toposort
())
else
:
# SamplingDotCSR's C implementation needs blas, so it should not
# be inserted
assert
not
any
(
isinstance
(
node
.
op
,
sparse
.
opt
.
SamplingDotCSR
)
for
node
in
f
.
maker
.
fgraph
.
toposort
())
theano/tensor/nnet/Conv3D.py
浏览文件 @
6f98d16a
...
...
@@ -51,7 +51,7 @@ class Conv3D(theano.Op):
return
"Conv3D"
def
c_code_cache_version
(
self
):
return
(
2
,)
return
(
3
,)
def
make_node
(
self
,
V
,
W
,
b
,
d
):
...
...
@@ -338,7 +338,8 @@ class Conv3D(theano.Op):
#if the data types are not mixed, we can insert special case optimizations based on BLAS
VV
,
WV
,
bv
,
dv
=
node
.
inputs
HV
=
node
.
outputs
[
0
]
if
VV
.
dtype
==
WV
.
dtype
and
HV
.
dtype
==
VV
.
dtype
:
if
(
theano
.
config
.
blas
.
ldflags
and
VV
.
dtype
==
WV
.
dtype
and
HV
.
dtype
==
VV
.
dtype
):
if
VV
.
dtype
==
'float64'
:
gemv
=
'dgemv_'
elif
VV
.
dtype
==
'float32'
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论