Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
22b943c3
提交
22b943c3
authored
3月 17, 2016
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4249 from lamblin/fix_windows
Fix windows test failures
上级
08963819
ab6a8441
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
102 行增加
和
22 行删除
+102
-22
opt.py
theano/sandbox/cuda/opt.py
+1
-1
test_conv_cuda_ndarray.py
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
+9
-4
test_dnn.py
theano/sandbox/cuda/tests/test_dnn.py
+17
-4
test_type.py
theano/sandbox/cuda/tests/test_type.py
+25
-2
test_pickle.py
theano/sandbox/gpuarray/tests/test_pickle.py
+13
-1
test_multinomial.py
theano/sandbox/tests/test_multinomial.py
+16
-2
basic.py
theano/scalar/basic.py
+7
-1
abstract_conv.py
theano/tensor/nnet/abstract_conv.py
+3
-1
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/opt.py
浏览文件 @
22b943c3
...
...
@@ -1944,7 +1944,7 @@ def local_gpu_downsample_factor_max_grad_grad(node):
'padding'
,
'mode'
)
if
(
node
.
op
.
padding
!=
(
0
,
0
)
or
node
.
op
.
mode
!=
'max'
or
node
.
op
.
st
!=
(
1
,
1
)
):
node
.
op
.
st
!=
node
.
op
.
ds
):
return
x
,
z
,
gx
=
node
.
inputs
if
(
x
.
owner
and
isinstance
(
x
.
owner
.
op
,
HostFromGpu
)):
...
...
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
浏览文件 @
22b943c3
...
...
@@ -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
,
corr_op_dki
,
conv_op_dki
])
# TODO: fix when the abstractconv tests can pass debug mode.
mode
=
theano_mode
if
theano
.
config
.
mode
==
'DEBUG_MODE'
:
mode
=
theano
.
compile
.
mode
.
get_mode
(
'FAST_RUN'
)
.
including
(
'gpu'
)
if
not
theano
.
config
.
blas
.
ldflags
:
# Some of the operations are not transferred to the GPU,
# and withoug BLAS, the abstract Op will not be optimized
# 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
)
allvals
=
f
(
npy_img
,
npy_kern
)
...
...
theano/sandbox/cuda/tests/test_dnn.py
浏览文件 @
22b943c3
import
logging
import
os
import
sys
from
nose.plugins.skip
import
SkipTest
import
numpy
from
itertools
import
chain
,
product
import
six.moves.cPickle
as
pickle
import
os
from
six
import
StringIO
from
six
import
reraise
import
numpy
import
theano
from
six
import
StringIO
import
theano.tensor
as
T
import
theano.tests.unittest_tools
as
utt
from
theano.sandbox.neighbours
import
images2neibs
...
...
@@ -390,7 +393,17 @@ def test_old_pool_interface():
testfile_dir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
fname
=
'old_pool_interface.pkl'
with
open
(
os
.
path
.
join
(
testfile_dir
,
fname
),
'rb'
)
as
fp
:
pickle
.
load
(
fp
)
try
:
pickle
.
load
(
fp
)
except
ImportError
:
# Windows sometimes fail with nonsensical errors like:
# ImportError: No module named type
# ImportError: No module named copy_reg
# when "type" and "copy_reg" are builtin modules.
if
sys
.
platform
==
'win32'
:
exc_type
,
exc_value
,
exc_trace
=
sys
.
exc_info
()
reraise
(
SkipTest
,
exc_value
,
exc_trace
)
raise
def
test_pooling3d
():
...
...
theano/sandbox/cuda/tests/test_type.py
浏览文件 @
22b943c3
import
os.path
import
sys
from
six
import
reraise
from
nose.plugins.skip
import
SkipTest
from
nose.tools
import
assert_raises
...
...
@@ -40,7 +42,18 @@ def test_unpickle_cudandarray_as_numpy_ndarray_flag0():
else
:
u
=
CompatUnpickler
(
fp
)
if
cuda_available
:
mat
=
u
.
load
()
try
:
mat
=
u
.
load
()
except
ImportError
:
# Windows sometimes fail with nonsensical errors like:
# ImportError: No module named type
# ImportError: No module named copy_reg
# when "type" and "copy_reg" are builtin modules.
if
sys
.
platform
==
'win32'
:
exc_type
,
exc_value
,
exc_trace
=
sys
.
exc_info
()
reraise
(
SkipTest
,
exc_value
,
exc_trace
)
raise
assert
isinstance
(
mat
,
CudaNdarray
)
assert
numpy
.
asarray
(
mat
)[
0
]
==
-
42.0
else
:
...
...
@@ -62,7 +75,17 @@ def test_unpickle_cudandarray_as_numpy_ndarray_flag1():
u
=
CompatUnpickler
(
fp
,
encoding
=
"latin1"
)
else
:
u
=
CompatUnpickler
(
fp
)
mat
=
u
.
load
()
try
:
mat
=
u
.
load
()
except
ImportError
:
# Windows sometimes fail with nonsensical errors like:
# ImportError: No module named type
# ImportError: No module named copy_reg
# when "type" and "copy_reg" are builtin modules.
if
sys
.
platform
==
'win32'
:
exc_type
,
exc_value
,
exc_trace
=
sys
.
exc_info
()
reraise
(
SkipTest
,
exc_value
,
exc_trace
)
raise
assert
isinstance
(
mat
,
numpy
.
ndarray
)
assert
mat
[
0
]
==
-
42.0
...
...
theano/sandbox/gpuarray/tests/test_pickle.py
浏览文件 @
22b943c3
...
...
@@ -6,6 +6,8 @@ regular test file.
"""
import
os
import
sys
from
six
import
reraise
from
nose.plugins.skip
import
SkipTest
from
nose.tools
import
assert_raises
...
...
@@ -69,7 +71,17 @@ def test_unpickle_gpuarray_as_numpy_ndarray_flag2():
u
=
CompatUnpickler
(
fp
,
encoding
=
"latin1"
)
else
:
u
=
CompatUnpickler
(
fp
)
mat
=
u
.
load
()
try
:
mat
=
u
.
load
()
except
ImportError
:
# Windows sometimes fail with nonsensical errors like:
# ImportError: No module named type
# ImportError: No module named copy_reg
# when "type" and "copy_reg" are builtin modules.
if
sys
.
platform
==
'win32'
:
exc_type
,
exc_value
,
exc_trace
=
sys
.
exc_info
()
reraise
(
SkipTest
,
exc_value
,
exc_trace
)
raise
assert
isinstance
(
mat
,
numpy
.
ndarray
)
assert
mat
[
0
]
==
-
42.0
...
...
theano/sandbox/tests/test_multinomial.py
浏览文件 @
22b943c3
import
copy
import
os
import
sys
from
six
import
reraise
from
nose.plugins.skip
import
SkipTest
import
numpy
import
theano
...
...
@@ -8,7 +12,6 @@ from theano.sandbox import multinomial
from
theano.compile.mode
import
get_default_mode
,
predefined_linkers
import
theano.sandbox.cuda
as
cuda
import
theano.tests.unittest_tools
as
utt
import
os
from
theano.compat
import
PY3
from
theano.misc.pkl_utils
import
CompatUnpickler
...
...
@@ -91,7 +94,18 @@ def test_n_samples_compatibility():
u
=
CompatUnpickler
(
pkl_file
,
encoding
=
"latin1"
)
else
:
u
=
CompatUnpickler
(
pkl_file
)
X
,
samples
=
u
.
load
()
try
:
X
,
samples
=
u
.
load
()
except
ImportError
:
# Windows sometimes fail with nonsensical errors like:
# ImportError: No module named type
# ImportError: No module named copy_reg
# when "type" and "copy_reg" are builtin modules.
if
sys
.
platform
==
'win32'
:
exc_type
,
exc_value
,
exc_trace
=
sys
.
exc_info
()
reraise
(
SkipTest
,
exc_value
,
exc_trace
)
raise
f
=
theano
.
function
([
X
],
samples
)
res
=
f
(
numpy
.
random
.
randn
(
20
,
10
))
assert
numpy
.
all
(
res
.
sum
(
axis
=
1
)
==
1
)
...
...
theano/scalar/basic.py
浏览文件 @
22b943c3
...
...
@@ -1151,7 +1151,13 @@ class IsNan(FixedLogicalComparison):
(
z
,)
=
outputs
if
node
.
inputs
[
0
]
.
type
in
complex_types
:
raise
NotImplementedError
()
return
"
%(z)
s = isnan(
%(x)
s);"
%
locals
()
# Windows tries to be different and sometimes return -1, but we want
# to be consistent with numpy (which returns True), hence the "abs".
return
"
%(z)
s = abs(isnan(
%(x)
s));"
%
locals
()
def
c_code_cache_version
(
self
):
scalarop_version
=
super
(
IsNan
,
self
)
.
c_code_cache_version
()
return
tuple
(
scalarop_version
)
+
(
2
,)
isnan
=
IsNan
()
...
...
theano/tensor/nnet/abstract_conv.py
浏览文件 @
22b943c3
...
...
@@ -522,6 +522,7 @@ def bilinear_upsampling(input,
# first and last col
concat_mat
=
T
.
concatenate
((
concat_mat
[:,
:,
:,
:
1
],
concat_mat
,
concat_mat
[:,
:,
:,
-
1
:]),
axis
=
3
)
concat_col
=
col
+
2
pad
=
2
*
ratio
-
(
ratio
-
1
)
//
2
-
1
...
...
@@ -533,7 +534,8 @@ def bilinear_upsampling(input,
np
.
newaxis
,
:,
np
.
newaxis
],
input_shape
=
(
up_bs
,
1
,
row
*
ratio
,
col
),
row
*
ratio
,
concat_col
),
filter_shape
=
(
1
,
1
,
None
,
1
),
border_mode
=
(
pad
,
0
),
subsample
=
(
ratio
,
1
),
...
...
theano/tensor/nnet/opt.py
浏览文件 @
22b943c3
...
...
@@ -401,7 +401,7 @@ def local_abstractconv_check(node):
'do you have a BLAS library installed Theano can link against?'
%
node
.
op
.
__class__
.
__name__
)
optdb
.
register
(
'AbstracConvCheck'
,
optdb
.
register
(
'Abstrac
t
ConvCheck'
,
opt
.
in2out
(
local_abstractconv_check
,
name
=
"AbstractConvCheck"
),
48.7
,
'fast_compile'
,
'fast_run'
)
theano/tensor/nnet/tests/test_abstract_conv.py
浏览文件 @
22b943c3
...
...
@@ -538,6 +538,11 @@ class TestConvTypes(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
):
"""Gets numerical 1D kernel for bilinear upsampling"""
...
...
@@ -678,7 +683,7 @@ class TestBilinearUpsampling(unittest.TestCase):
bilin_mat
=
bilinear_upsampling
(
input
=
input_x
,
ratio
=
ratio
,
batch_size
=
1
,
num_input_channels
=
1
,
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
)
utt
.
assert_allclose
(
f
(),
up_mat_2d
,
rtol
=
1e-06
)
...
...
@@ -697,8 +702,8 @@ class TestBilinearUpsampling(unittest.TestCase):
mat_2D
=
bilinear_upsampling
(
input
=
input_x
,
ratio
=
5
,
batch_size
=
5
,
num_input_channels
=
4
,
use_1D_kernel
=
False
)
f_1D
=
theano
.
function
([],
mat_1D
)
f_2D
=
theano
.
function
([],
mat_2D
)
f_1D
=
theano
.
function
([],
mat_1D
,
mode
=
self
.
compile_mode
)
f_2D
=
theano
.
function
([],
mat_2D
,
mode
=
self
.
compile_mode
)
utt
.
assert_allclose
(
f_1D
(),
f_2D
(),
rtol
=
1e-06
)
# checking upsampling with ratio 8
...
...
@@ -709,6 +714,6 @@ class TestBilinearUpsampling(unittest.TestCase):
mat_2D
=
bilinear_upsampling
(
input
=
input_x
,
ratio
=
8
,
batch_size
=
12
,
num_input_channels
=
11
,
use_1D_kernel
=
False
)
f_1D
=
theano
.
function
([],
mat_1D
)
f_2D
=
theano
.
function
([],
mat_2D
)
f_1D
=
theano
.
function
([],
mat_1D
,
mode
=
self
.
compile_mode
)
f_2D
=
theano
.
function
([],
mat_2D
,
mode
=
self
.
compile_mode
)
utt
.
assert_allclose
(
f_1D
(),
f_2D
(),
rtol
=
1e-06
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论