Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2ef606f6
提交
2ef606f6
authored
3月 16, 2016
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable slow Python when no CPU BLAS in some tests
上级
cb1184d4
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
20 行增加
和
10 行删除
+20
-10
test_conv_cuda_ndarray.py
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
+9
-4
opt.py
theano/tensor/nnet/opt.py
+1
-1
test_abstract_conv.py
theano/tensor/nnet/tests/test_abstract_conv.py
+10
-5
没有找到文件。
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
浏览文件 @
2ef606f6
...
@@ -845,10 +845,15 @@ def conv_grad(mode, bs, ch, nf, rImg1, rImg2, rFlt1, rFlt2, subsample, op):
...
@@ -845,10 +845,15 @@ def conv_grad(mode, bs, ch, nf, rImg1, rImg2, rFlt1, rFlt2, subsample, op):
outputs
.
extend
([
corr_op_dik
,
conv_op_dik
,
outputs
.
extend
([
corr_op_dik
,
conv_op_dik
,
corr_op_dki
,
conv_op_dki
])
corr_op_dki
,
conv_op_dki
])
# TODO: fix when the abstractconv tests can pass debug mode.
if
not
theano
.
config
.
blas
.
ldflags
:
mode
=
theano_mode
# Some of the operations are not transferred to the GPU,
if
theano
.
config
.
mode
==
'DEBUG_MODE'
:
# and withoug BLAS, the abstract Op will not be optimized
mode
=
theano
.
compile
.
mode
.
get_mode
(
'FAST_RUN'
)
.
including
(
'gpu'
)
# to CorrMM either, so we have to accept the use of the
# slow Python convolution in that case.
mode
=
theano_mode
.
excluding
(
'AbstractConvCheck'
)
else
:
mode
=
theano_mode
f
=
theano
.
function
([
i
,
k
],
outputs
,
mode
=
mode
)
f
=
theano
.
function
([
i
,
k
],
outputs
,
mode
=
mode
)
allvals
=
f
(
npy_img
,
npy_kern
)
allvals
=
f
(
npy_img
,
npy_kern
)
...
...
theano/tensor/nnet/opt.py
浏览文件 @
2ef606f6
...
@@ -401,7 +401,7 @@ def local_abstractconv_check(node):
...
@@ -401,7 +401,7 @@ def local_abstractconv_check(node):
'do you have a BLAS library installed Theano can link against?'
%
'do you have a BLAS library installed Theano can link against?'
%
node
.
op
.
__class__
.
__name__
)
node
.
op
.
__class__
.
__name__
)
optdb
.
register
(
'AbstracConvCheck'
,
optdb
.
register
(
'Abstrac
t
ConvCheck'
,
opt
.
in2out
(
local_abstractconv_check
,
opt
.
in2out
(
local_abstractconv_check
,
name
=
"AbstractConvCheck"
),
name
=
"AbstractConvCheck"
),
48.7
,
'fast_compile'
,
'fast_run'
)
48.7
,
'fast_compile'
,
'fast_run'
)
theano/tensor/nnet/tests/test_abstract_conv.py
浏览文件 @
2ef606f6
...
@@ -538,6 +538,11 @@ class TestConvTypes(unittest.TestCase):
...
@@ -538,6 +538,11 @@ class TestConvTypes(unittest.TestCase):
class
TestBilinearUpsampling
(
unittest
.
TestCase
):
class
TestBilinearUpsampling
(
unittest
.
TestCase
):
# If BLAS is not available on CPU, then we accept the fallback to the
# slow Python implementation for that test.
compile_mode
=
theano
.
compile
.
mode
.
get_default_mode
()
if
not
theano
.
config
.
blas
.
ldflags
:
compile_mode
=
compile_mode
.
excluding
(
'AbstractConvCheck'
)
def
numerical_kernel_1D
(
self
,
ratio
):
def
numerical_kernel_1D
(
self
,
ratio
):
"""Gets numerical 1D kernel for bilinear upsampling"""
"""Gets numerical 1D kernel for bilinear upsampling"""
...
@@ -678,7 +683,7 @@ class TestBilinearUpsampling(unittest.TestCase):
...
@@ -678,7 +683,7 @@ class TestBilinearUpsampling(unittest.TestCase):
bilin_mat
=
bilinear_upsampling
(
input
=
input_x
,
ratio
=
ratio
,
bilin_mat
=
bilinear_upsampling
(
input
=
input_x
,
ratio
=
ratio
,
batch_size
=
1
,
num_input_channels
=
1
,
batch_size
=
1
,
num_input_channels
=
1
,
use_1D_kernel
=
True
)
use_1D_kernel
=
True
)
f
=
theano
.
function
([],
bilin_mat
)
f
=
theano
.
function
([],
bilin_mat
,
mode
=
self
.
compile_mode
)
up_mat_2d
=
self
.
get_upsampled_twobytwo_mat
(
input_x
,
ratio
)
up_mat_2d
=
self
.
get_upsampled_twobytwo_mat
(
input_x
,
ratio
)
utt
.
assert_allclose
(
f
(),
up_mat_2d
,
rtol
=
1e-06
)
utt
.
assert_allclose
(
f
(),
up_mat_2d
,
rtol
=
1e-06
)
...
@@ -697,8 +702,8 @@ class TestBilinearUpsampling(unittest.TestCase):
...
@@ -697,8 +702,8 @@ class TestBilinearUpsampling(unittest.TestCase):
mat_2D
=
bilinear_upsampling
(
input
=
input_x
,
ratio
=
5
,
mat_2D
=
bilinear_upsampling
(
input
=
input_x
,
ratio
=
5
,
batch_size
=
5
,
num_input_channels
=
4
,
batch_size
=
5
,
num_input_channels
=
4
,
use_1D_kernel
=
False
)
use_1D_kernel
=
False
)
f_1D
=
theano
.
function
([],
mat_1D
)
f_1D
=
theano
.
function
([],
mat_1D
,
mode
=
self
.
compile_mode
)
f_2D
=
theano
.
function
([],
mat_2D
)
f_2D
=
theano
.
function
([],
mat_2D
,
mode
=
self
.
compile_mode
)
utt
.
assert_allclose
(
f_1D
(),
f_2D
(),
rtol
=
1e-06
)
utt
.
assert_allclose
(
f_1D
(),
f_2D
(),
rtol
=
1e-06
)
# checking upsampling with ratio 8
# checking upsampling with ratio 8
...
@@ -709,6 +714,6 @@ class TestBilinearUpsampling(unittest.TestCase):
...
@@ -709,6 +714,6 @@ class TestBilinearUpsampling(unittest.TestCase):
mat_2D
=
bilinear_upsampling
(
input
=
input_x
,
ratio
=
8
,
mat_2D
=
bilinear_upsampling
(
input
=
input_x
,
ratio
=
8
,
batch_size
=
12
,
num_input_channels
=
11
,
batch_size
=
12
,
num_input_channels
=
11
,
use_1D_kernel
=
False
)
use_1D_kernel
=
False
)
f_1D
=
theano
.
function
([],
mat_1D
)
f_1D
=
theano
.
function
([],
mat_1D
,
mode
=
self
.
compile_mode
)
f_2D
=
theano
.
function
([],
mat_2D
)
f_2D
=
theano
.
function
([],
mat_2D
,
mode
=
self
.
compile_mode
)
utt
.
assert_allclose
(
f_1D
(),
f_2D
(),
rtol
=
1e-06
)
utt
.
assert_allclose
(
f_1D
(),
f_2D
(),
rtol
=
1e-06
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论