Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0743dbc0
提交
0743dbc0
authored
3月 07, 2016
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4176 from nouiz/blas
Make BatchedDot don't try to use c code if there is no blas.
上级
e563c53c
b68528be
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
29 行增加
和
3 行删除
+29
-3
blas.py
theano/tensor/blas.py
+4
-0
corr.py
theano/tensor/nnet/corr.py
+2
-0
test_abstract_conv.py
theano/tensor/nnet/tests/test_abstract_conv.py
+23
-3
没有找到文件。
theano/tensor/blas.py
浏览文件 @
0743dbc0
...
@@ -2134,6 +2134,10 @@ class BatchedDot(Op):
...
@@ -2134,6 +2134,10 @@ class BatchedDot(Op):
_z
,
=
out
_z
,
=
out
fail
=
sub
[
"fail"
]
fail
=
sub
[
"fail"
]
if
not
config
.
blas
.
ldflags
:
return
super
(
BatchedDot
,
self
)
.
c_code
(
node
,
name
,
inp
,
out
,
sub
)
# generate contiguity condition
# generate contiguity condition
def
contiguous
(
var
,
ndim
):
def
contiguous
(
var
,
ndim
):
strides
=
"PyArray_STRIDES(
%
s)"
%
var
strides
=
"PyArray_STRIDES(
%
s)"
%
var
...
...
theano/tensor/nnet/corr.py
浏览文件 @
0743dbc0
...
@@ -149,6 +149,8 @@ class BaseCorrMM(gof.Op):
...
@@ -149,6 +149,8 @@ class BaseCorrMM(gof.Op):
If self.border_mode == 'half', a variable giving the width of the
If self.border_mode == 'half', a variable giving the width of the
filters for direction="backprop weights". Ignored otherwise.
filters for direction="backprop weights". Ignored otherwise.
"""
"""
if
not
theano
.
config
.
blas
.
ldflags
:
raise
NotImplementedError
(
"C code for CorrMM* classes need a blas library."
)
dH
,
dW
=
self
.
subsample
dH
,
dW
=
self
.
subsample
if
self
.
border_mode
==
"half"
:
if
self
.
border_mode
==
"half"
:
padH
=
padW
=
-
1
padH
=
padW
=
-
1
...
...
theano/tensor/nnet/tests/test_abstract_conv.py
浏览文件 @
0743dbc0
...
@@ -245,14 +245,26 @@ class BaseTestConv2d(unittest.TestCase):
...
@@ -245,14 +245,26 @@ class BaseTestConv2d(unittest.TestCase):
db
=
(
0
,
0
)
db
=
(
0
,
0
)
dflip
=
True
in
self
.
filter_flip
dflip
=
True
in
self
.
filter_flip
dprovide_shape
=
True
in
self
.
provide_shape
dprovide_shape
=
True
in
self
.
provide_shape
skipped
=
False
for
(
i
,
f
)
in
zip
(
self
.
inputs_shapes
,
self
.
filters_shapes
):
for
(
i
,
f
)
in
zip
(
self
.
inputs_shapes
,
self
.
filters_shapes
):
for
provide_shape
in
self
.
provide_shape
:
for
provide_shape
in
self
.
provide_shape
:
self
.
tcase
(
i
,
f
,
ds
,
db
,
dflip
,
provide_shape
)
try
:
self
.
tcase
(
i
,
f
,
ds
,
db
,
dflip
,
provide_shape
)
except
SkipTest
as
e
:
skipped
=
e
for
s
in
self
.
subsamples
:
for
s
in
self
.
subsamples
:
for
b
in
self
.
border_modes
:
for
b
in
self
.
border_modes
:
self
.
tcase
(
i
,
f
,
s
,
db
,
dflip
,
dprovide_shape
)
try
:
self
.
tcase
(
i
,
f
,
s
,
db
,
dflip
,
dprovide_shape
)
except
SkipTest
as
e
:
skipped
=
e
for
flip
in
self
.
filter_flip
:
for
flip
in
self
.
filter_flip
:
self
.
tcase
(
i
,
f
,
ds
,
db
,
flip
,
dprovide_shape
)
try
:
self
.
tcase
(
i
,
f
,
ds
,
db
,
flip
,
dprovide_shape
)
except
SkipTest
as
e
:
skipped
=
e
if
skipped
:
raise
skipped
class
TestCorrConv2d
(
BaseTestConv2d
):
class
TestCorrConv2d
(
BaseTestConv2d
):
...
@@ -263,6 +275,8 @@ class TestCorrConv2d(BaseTestConv2d):
...
@@ -263,6 +275,8 @@ class TestCorrConv2d(BaseTestConv2d):
def
tcase
(
self
,
i
,
f
,
s
,
b
,
flip
,
provide_shape
):
def
tcase
(
self
,
i
,
f
,
s
,
b
,
flip
,
provide_shape
):
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
)
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
)
if
not
theano
.
config
.
blas
.
ldflags
:
raise
SkipTest
(
"Need blas to test conv2d"
)
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
verify_grad
=
True
,
provide_shape
=
provide_shape
,
verify_grad
=
True
,
provide_shape
=
provide_shape
,
border_mode
=
b
,
filter_flip
=
flip
,
target_op
=
CorrMM
)
border_mode
=
b
,
filter_flip
=
flip
,
target_op
=
CorrMM
)
...
@@ -307,6 +321,8 @@ class TestCpuConv2d(BaseTestConv2d):
...
@@ -307,6 +321,8 @@ class TestCpuConv2d(BaseTestConv2d):
gradinput_OK
=
False
gradinput_OK
=
False
if
fwd_OK
:
if
fwd_OK
:
if
not
theano
.
config
.
blas
.
ldflags
:
raise
SkipTest
(
"Need blas to test conv2d"
)
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
verify_grad
=
(
gradweight_OK
and
gradinput_OK
),
verify_grad
=
(
gradweight_OK
and
gradinput_OK
),
mode
=
mode
,
provide_shape
=
provide_shape
,
mode
=
mode
,
provide_shape
=
provide_shape
,
...
@@ -324,6 +340,8 @@ class TestCpuConv2d(BaseTestConv2d):
...
@@ -324,6 +340,8 @@ class TestCpuConv2d(BaseTestConv2d):
filter_flip
=
flip
)
filter_flip
=
flip
)
if
gradweight_OK
:
if
gradweight_OK
:
if
not
theano
.
config
.
blas
.
ldflags
:
raise
SkipTest
(
"Need blas to test conv2d"
)
self
.
run_gradweight
(
inputs_shape
=
i
,
filters_shape
=
f
,
self
.
run_gradweight
(
inputs_shape
=
i
,
filters_shape
=
f
,
output_shape
=
o
,
subsample
=
s
,
output_shape
=
o
,
subsample
=
s
,
verify_grad
=
False
,
mode
=
mode
,
verify_grad
=
False
,
mode
=
mode
,
...
@@ -344,6 +362,8 @@ class TestCpuConv2d(BaseTestConv2d):
...
@@ -344,6 +362,8 @@ class TestCpuConv2d(BaseTestConv2d):
filter_flip
=
flip
)
filter_flip
=
flip
)
if
gradinput_OK
:
if
gradinput_OK
:
if
not
theano
.
config
.
blas
.
ldflags
:
raise
SkipTest
(
"Need blas to test conv2d"
)
self
.
run_gradinput
(
inputs_shape
=
i
,
filters_shape
=
f
,
self
.
run_gradinput
(
inputs_shape
=
i
,
filters_shape
=
f
,
output_shape
=
o
,
subsample
=
s
,
output_shape
=
o
,
subsample
=
s
,
verify_grad
=
False
,
mode
=
mode
,
verify_grad
=
False
,
mode
=
mode
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论