Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b56a541c
提交
b56a541c
authored
9月 27, 2017
作者:
notoraptor
提交者:
GitHub
9月 27, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6446 from nouiz/no_scipy_tests
Fix opt crash and crash/tests when SciPy is not there.
上级
42f0bbf3
883c918f
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
67 行增加
和
34 行删除
+67
-34
__init__.py
theano/gpuarray/__init__.py
+1
-1
opt_util.py
theano/gpuarray/opt_util.py
+3
-3
test_elemwise.py
theano/gpuarray/tests/test_elemwise.py
+9
-1
test_linalg.py
theano/gpuarray/tests/test_linalg.py
+3
-1
test_opt.py
theano/gpuarray/tests/test_opt.py
+8
-8
elemwise.py
theano/tensor/elemwise.py
+1
-1
test_abstract_conv.py
theano/tensor/nnet/tests/test_abstract_conv.py
+16
-6
_test_mpi_roundtrip.py
theano/tensor/tests/_test_mpi_roundtrip.py
+1
-0
test_mpi.py
theano/tensor/tests/test_mpi.py
+17
-10
test_flake8.py
theano/tests/test_flake8.py
+5
-3
version.py
theano/version.py
+3
-0
没有找到文件。
theano/gpuarray/__init__.py
浏览文件 @
b56a541c
...
@@ -45,7 +45,7 @@ def pygpu_parse_version(version_string):
...
@@ -45,7 +45,7 @@ def pygpu_parse_version(version_string):
from
collections
import
namedtuple
from
collections
import
namedtuple
version_type
=
namedtuple
(
'version_type'
,
(
'major'
,
'minor'
,
'patch'
,
'fullversion'
))
version_type
=
namedtuple
(
'version_type'
,
(
'major'
,
'minor'
,
'patch'
,
'fullversion'
))
pieces
=
version_string
.
split
(
'.'
,
2
)
pieces
=
version_string
.
split
(
'.'
,
2
)
assert
len
(
pieces
)
==
3
assert
len
(
pieces
)
==
3
,
version_string
major
=
int
(
pieces
[
0
])
major
=
int
(
pieces
[
0
])
minor
=
int
(
pieces
[
1
])
minor
=
int
(
pieces
[
1
])
if
"+"
in
pieces
[
2
]:
# It contain a git commit.
if
"+"
in
pieces
[
2
]:
# It contain a git commit.
...
...
theano/gpuarray/opt_util.py
浏览文件 @
b56a541c
...
@@ -12,8 +12,6 @@ from theano.tensor import (DimShuffle, get_scalar_constant_value,
...
@@ -12,8 +12,6 @@ from theano.tensor import (DimShuffle, get_scalar_constant_value,
from
.basic_ops
import
GpuFromHost
,
HostFromGpu
,
GpuAllocEmpty
,
GpuReshape
from
.basic_ops
import
GpuFromHost
,
HostFromGpu
,
GpuAllocEmpty
,
GpuReshape
from
.elemwise
import
GpuDimShuffle
,
GpuElemwise
from
.elemwise
import
GpuDimShuffle
,
GpuElemwise
_one
=
scal
.
constant
(
np
.
asarray
(
1.0
,
dtype
=
'float32'
))
def
grab_cpu_scalar
(
v
,
nd
):
def
grab_cpu_scalar
(
v
,
nd
):
"""
"""
...
@@ -273,7 +271,9 @@ def output_merge(cls, alpha_in, beta_in, out_in):
...
@@ -273,7 +271,9 @@ def output_merge(cls, alpha_in, beta_in, out_in):
return
None
return
None
inputs
=
list
(
targ
.
inputs
)
inputs
=
list
(
targ
.
inputs
)
inputs
[
out_in
]
=
W
inputs
[
out_in
]
=
W
inputs
[
beta_in
]
=
_one
.
clone
()
dtype
=
inputs
[
beta_in
]
.
dtype
one
=
scal
.
constant
(
np
.
asarray
(
1.0
,
dtype
=
dtype
))
inputs
[
beta_in
]
=
one
with
inherit_stack_trace
(
node
.
outputs
):
with
inherit_stack_trace
(
node
.
outputs
):
return
maker
(
targ
,
*
inputs
)
return
maker
(
targ
,
*
inputs
)
return
opt
return
opt
...
...
theano/gpuarray/tests/test_elemwise.py
浏览文件 @
b56a541c
...
@@ -3,7 +3,6 @@ from copy import copy
...
@@ -3,7 +3,6 @@ from copy import copy
from
unittest
import
TestCase
from
unittest
import
TestCase
import
numpy
as
np
import
numpy
as
np
import
scipy.special
import
theano
import
theano
from
theano
import
scalar
,
gof
,
tensor
from
theano
import
scalar
,
gof
,
tensor
...
@@ -22,6 +21,13 @@ from ..type import GpuArrayType, get_context, gpuarray_shared_constructor
...
@@ -22,6 +21,13 @@ from ..type import GpuArrayType, get_context, gpuarray_shared_constructor
from
pygpu
import
ndgpuarray
as
gpuarray
from
pygpu
import
ndgpuarray
as
gpuarray
imported_scipy_special
=
False
try
:
import
scipy.special
imported_scipy_special
=
True
except
ImportError
:
pass
# This is actually a test for GpuElemwise
# This is actually a test for GpuElemwise
class
test_gpu_Broadcast
(
test_elemwise
.
test_Broadcast
):
class
test_gpu_Broadcast
(
test_elemwise
.
test_Broadcast
):
...
@@ -73,6 +79,8 @@ class TestMathErrorFunctions(TestCase):
...
@@ -73,6 +79,8 @@ class TestMathErrorFunctions(TestCase):
@classmethod
@classmethod
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
if
not
imported_scipy_special
:
raise
SkipTest
(
"scipy.special needed"
)
# NB: erfinv is defined in ]-1;1[, and erfcinv is defined in ]0;2[,
# NB: erfinv is defined in ]-1;1[, and erfcinv is defined in ]0;2[,
# so we just take some values in an interval that covers both domains
# so we just take some values in an interval that covers both domains
# (this will also allow to test some values outside the domains).
# (this will also allow to test some values outside the domains).
...
...
theano/gpuarray/tests/test_linalg.py
浏览文件 @
b56a541c
...
@@ -14,7 +14,7 @@ from theano.gpuarray.linalg import (GpuCholesky, GpuMagmaCholesky,
...
@@ -14,7 +14,7 @@ from theano.gpuarray.linalg import (GpuCholesky, GpuMagmaCholesky,
gpu_solve
,
gpu_svd
,
gpu_qr
)
gpu_solve
,
gpu_svd
,
gpu_qr
)
from
theano.tensor.nlinalg
import
(
SVD
,
MatrixInverse
,
QRFull
,
from
theano.tensor.nlinalg
import
(
SVD
,
MatrixInverse
,
QRFull
,
QRIncomplete
,
eigh
,
matrix_inverse
,
qr
)
QRIncomplete
,
eigh
,
matrix_inverse
,
qr
)
from
theano.tensor.slinalg
import
Cholesky
,
cholesky
from
theano.tensor.slinalg
import
Cholesky
,
cholesky
,
imported_scipy
from
theano.tests
import
unittest_tools
as
utt
from
theano.tests
import
unittest_tools
as
utt
from
..
import
gpuarray_shared_constructor
from
..
import
gpuarray_shared_constructor
...
@@ -149,6 +149,8 @@ class TestGpuCholesky(unittest.TestCase):
...
@@ -149,6 +149,8 @@ class TestGpuCholesky(unittest.TestCase):
utt
.
assert_allclose
(
chol_A_res
,
chol_A_val
)
utt
.
assert_allclose
(
chol_A_res
,
chol_A_val
)
def
test_gpu_cholesky_opt
(
self
):
def
test_gpu_cholesky_opt
(
self
):
if
not
imported_scipy
:
self
.
skipTest
(
'SciPy is not enabled, skipping test'
)
A
=
theano
.
tensor
.
matrix
(
"A"
,
dtype
=
"float32"
)
A
=
theano
.
tensor
.
matrix
(
"A"
,
dtype
=
"float32"
)
fn
=
theano
.
function
([
A
],
cholesky
(
A
),
mode
=
mode_with_gpu
)
fn
=
theano
.
function
([
A
],
cholesky
(
A
),
mode
=
mode_with_gpu
)
assert
any
([
isinstance
(
node
.
op
,
GpuCholesky
)
assert
any
([
isinstance
(
node
.
op
,
GpuCholesky
)
...
...
theano/gpuarray/tests/test_opt.py
浏览文件 @
b56a541c
...
@@ -642,8 +642,8 @@ def test_no_complex():
...
@@ -642,8 +642,8 @@ def test_no_complex():
@utt.assertFailure_fast
@utt.assertFailure_fast
def
test_local_lift_solve
():
def
test_local_lift_solve
():
if
not
cusolver_available
:
if
not
cusolver_available
or
not
slinalg
.
imported_scipy
:
raise
SkipTest
(
'No cuSolver'
)
raise
SkipTest
(
'No cuSolver
or SciPy
'
)
A
=
tensor
.
fmatrix
()
A
=
tensor
.
fmatrix
()
b
=
tensor
.
fmatrix
()
b
=
tensor
.
fmatrix
()
o
=
slinalg
.
solve
(
A
,
b
)
o
=
slinalg
.
solve
(
A
,
b
)
...
@@ -660,8 +660,8 @@ def test_local_lift_solve():
...
@@ -660,8 +660,8 @@ def test_local_lift_solve():
def
test_gpu_solve_not_inplace
():
def
test_gpu_solve_not_inplace
():
if
not
cusolver_available
:
if
not
cusolver_available
or
not
slinalg
.
imported_scipy
:
raise
SkipTest
(
'No cuSolver'
)
raise
SkipTest
(
'No cuSolver
or Scipy
'
)
A
=
tensor
.
fmatrix
()
A
=
tensor
.
fmatrix
()
b
=
tensor
.
fmatrix
()
b
=
tensor
.
fmatrix
()
s
=
slinalg
.
solve
(
A
,
b
)
s
=
slinalg
.
solve
(
A
,
b
)
...
@@ -678,8 +678,8 @@ def test_gpu_solve_not_inplace():
...
@@ -678,8 +678,8 @@ def test_gpu_solve_not_inplace():
@utt.assertFailure_fast
@utt.assertFailure_fast
def
test_local_lift_cholesky
():
def
test_local_lift_cholesky
():
if
not
cusolver_available
:
if
not
cusolver_available
or
not
slinalg
.
imported_scipy
:
raise
SkipTest
(
'No cuSolver'
)
raise
SkipTest
(
'No cuSolver
or Scipy
'
)
A
=
tensor
.
fmatrix
()
A
=
tensor
.
fmatrix
()
o
=
slinalg
.
cholesky
(
A
)
o
=
slinalg
.
cholesky
(
A
)
f_cpu
=
theano
.
function
([
A
],
o
,
mode
=
mode_without_gpu
)
f_cpu
=
theano
.
function
([
A
],
o
,
mode
=
mode_without_gpu
)
...
@@ -696,8 +696,8 @@ def test_local_lift_cholesky():
...
@@ -696,8 +696,8 @@ def test_local_lift_cholesky():
def
test_gpu_cholesky_not_inplace
():
def
test_gpu_cholesky_not_inplace
():
if
not
cusolver_available
:
if
not
cusolver_available
or
not
slinalg
.
imported_scipy
:
raise
SkipTest
(
'No cuSolver'
)
raise
SkipTest
(
'No cuSolver
or SciPy
'
)
A
=
tensor
.
fmatrix
()
A
=
tensor
.
fmatrix
()
A_squared
=
A
**
2
A_squared
=
A
**
2
B
=
slinalg
.
cholesky
(
A_squared
)
B
=
slinalg
.
cholesky
(
A_squared
)
...
...
theano/tensor/elemwise.py
浏览文件 @
b56a541c
...
@@ -649,7 +649,7 @@ second dimension
...
@@ -649,7 +649,7 @@ second dimension
# - NumPy ufunc support only up to 31 inputs.
# - NumPy ufunc support only up to 31 inputs.
# But our c code support more.
# But our c code support more.
# - nfunc is reused for scipy and scipy is optional
# - nfunc is reused for scipy and scipy is optional
if
getattr
(
self
,
'nfunc_spec'
,
None
):
if
getattr
(
self
,
'nfunc_spec'
,
None
)
and
impl
!=
'c'
:
self
.
nfunc
=
getattr
(
np
,
self
.
nfunc_spec
[
0
],
None
)
self
.
nfunc
=
getattr
(
np
,
self
.
nfunc_spec
[
0
],
None
)
if
self
.
nfunc
is
None
:
if
self
.
nfunc
is
None
:
# Not inside NumPy. So probably another package like scipy.
# Not inside NumPy. So probably another package like scipy.
...
...
theano/tensor/nnet/tests/test_abstract_conv.py
浏览文件 @
b56a541c
...
@@ -741,6 +741,8 @@ class TestAbstractConvNoOptim(BaseTestConv2d):
...
@@ -741,6 +741,8 @@ class TestAbstractConvNoOptim(BaseTestConv2d):
cls
.
border_modes
=
[
"valid"
,
"half"
,
"full"
]
cls
.
border_modes
=
[
"valid"
,
"half"
,
"full"
]
cls
.
filter_flip
=
[
True
]
cls
.
filter_flip
=
[
True
]
cls
.
provide_shape
=
[
False
]
cls
.
provide_shape
=
[
False
]
if
not
theano
.
tensor
.
nnet
.
abstract_conv
.
imported_scipy_signal
:
raise
SkipTest
(
"SciPy needed"
)
def
tcase
(
self
,
i
,
f
,
s
,
b
,
flip
,
provide_shape
,
fd
=
(
1
,
1
)):
def
tcase
(
self
,
i
,
f
,
s
,
b
,
flip
,
provide_shape
,
fd
=
(
1
,
1
)):
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
,
fd
)
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
,
fd
)
...
@@ -1454,8 +1456,8 @@ class Grouped_conv_noOptim(unittest.TestCase):
...
@@ -1454,8 +1456,8 @@ class Grouped_conv_noOptim(unittest.TestCase):
self
.
corr_fwd
=
conv2d_corr
self
.
corr_fwd
=
conv2d_corr
self
.
corr_gradw
=
conv2d_corr_gw
self
.
corr_gradw
=
conv2d_corr_gw
self
.
corr_gradi
=
conv2d_corr_gi
self
.
corr_gradi
=
conv2d_corr_gi
if
theano
.
config
.
cxx
==
""
:
if
theano
.
config
.
cxx
==
""
or
not
theano
.
tensor
.
nnet
.
abstract_conv
.
imported_scipy_signal
:
raise
SkipTest
(
"CorrMM needs cxx"
)
raise
SkipTest
(
"CorrMM needs cxx
and SciPy
"
)
def
test_fwd
(
self
):
def
test_fwd
(
self
):
if
self
.
convdim
==
2
:
if
self
.
convdim
==
2
:
...
@@ -1621,7 +1623,7 @@ class Grouped_conv3d_noOptim(Grouped_conv_noOptim):
...
@@ -1621,7 +1623,7 @@ class Grouped_conv3d_noOptim(Grouped_conv_noOptim):
self
.
corr_fwd
=
conv3d_corr
self
.
corr_fwd
=
conv3d_corr
self
.
corr_gradw
=
conv3d_corr_gw
self
.
corr_gradw
=
conv3d_corr_gw
self
.
corr_gradi
=
conv3d_corr_gi
self
.
corr_gradi
=
conv3d_corr_gi
if
theano
.
config
.
cxx
==
""
:
if
theano
.
config
.
cxx
==
""
or
not
theano
.
tensor
.
nnet
.
abstract_conv
.
imported_scipy_signal
:
raise
SkipTest
(
"CorrMM needs cxx"
)
raise
SkipTest
(
"CorrMM needs cxx"
)
...
@@ -1770,8 +1772,8 @@ class TestUnsharedConv(unittest.TestCase):
...
@@ -1770,8 +1772,8 @@ class TestUnsharedConv(unittest.TestCase):
self
.
verify_flags
=
[
True
]
*
4
self
.
verify_flags
=
[
True
]
*
4
self
.
ref_mode
=
'FAST_RUN'
self
.
ref_mode
=
'FAST_RUN'
if
theano
.
config
.
cxx
==
""
:
if
theano
.
config
.
cxx
==
""
or
not
theano
.
tensor
.
nnet
.
abstract_conv
.
imported_scipy_signal
:
raise
SkipTest
(
"CorrMM needs cxx"
)
raise
SkipTest
(
"CorrMM needs cxx
or SciPy
"
)
def
test_fwd
(
self
):
def
test_fwd
(
self
):
tensor6
=
theano
.
tensor
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,)
*
6
)
tensor6
=
theano
.
tensor
.
TensorType
(
theano
.
config
.
floatX
,
(
False
,)
*
6
)
...
@@ -1913,6 +1915,8 @@ class TestAsymmetricPadding(unittest.TestCase):
...
@@ -1913,6 +1915,8 @@ class TestAsymmetricPadding(unittest.TestCase):
border_mode
=
[((
1
,
2
),
(
2
,
1
)),
((
1
,
1
),
(
0
,
3
)),
((
2
,
1
),
(
0
,
0
))]
border_mode
=
[((
1
,
2
),
(
2
,
1
)),
((
1
,
1
),
(
0
,
3
)),
((
2
,
1
),
(
0
,
0
))]
def
test_fwd
(
self
):
def
test_fwd
(
self
):
if
not
theano
.
tensor
.
nnet
.
abstract_conv
.
imported_scipy_signal
:
raise
SkipTest
(
"SciPy needed"
)
img_sym
=
theano
.
tensor
.
tensor4
(
'img'
)
img_sym
=
theano
.
tensor
.
tensor4
(
'img'
)
kern_sym
=
theano
.
tensor
.
tensor4
(
'kern'
)
kern_sym
=
theano
.
tensor
.
tensor4
(
'kern'
)
...
@@ -1947,6 +1951,9 @@ class TestAsymmetricPadding(unittest.TestCase):
...
@@ -1947,6 +1951,9 @@ class TestAsymmetricPadding(unittest.TestCase):
utt
.
verify_grad
(
asymmetric_conv_op
,
[
img
,
kern
],
mode
=
self
.
mode
,
eps
=
1
)
utt
.
verify_grad
(
asymmetric_conv_op
,
[
img
,
kern
],
mode
=
self
.
mode
,
eps
=
1
)
def
test_gradweight
(
self
):
def
test_gradweight
(
self
):
if
not
theano
.
tensor
.
nnet
.
abstract_conv
.
imported_scipy_signal
:
raise
SkipTest
(
"SciPy needed"
)
img_sym
=
theano
.
tensor
.
tensor4
(
'img'
)
img_sym
=
theano
.
tensor
.
tensor4
(
'img'
)
top_sym
=
theano
.
tensor
.
tensor4
(
'top'
)
top_sym
=
theano
.
tensor
.
tensor4
(
'top'
)
...
@@ -1984,6 +1991,8 @@ class TestAsymmetricPadding(unittest.TestCase):
...
@@ -1984,6 +1991,8 @@ class TestAsymmetricPadding(unittest.TestCase):
utt
.
verify_grad
(
conv_gradweight
,
[
img
,
top
],
mode
=
self
.
mode
,
eps
=
1
)
utt
.
verify_grad
(
conv_gradweight
,
[
img
,
top
],
mode
=
self
.
mode
,
eps
=
1
)
def
test_gradinput
(
self
):
def
test_gradinput
(
self
):
if
not
theano
.
tensor
.
nnet
.
abstract_conv
.
imported_scipy_signal
:
raise
SkipTest
(
"SciPy needed"
)
kern_sym
=
theano
.
tensor
.
tensor4
(
'kern'
)
kern_sym
=
theano
.
tensor
.
tensor4
(
'kern'
)
top_sym
=
theano
.
tensor
.
tensor4
(
'top'
)
top_sym
=
theano
.
tensor
.
tensor4
(
'top'
)
...
@@ -2035,7 +2044,8 @@ class TestCausalConv(unittest.TestCase):
...
@@ -2035,7 +2044,8 @@ class TestCausalConv(unittest.TestCase):
def
test_interface
(
self
):
def
test_interface
(
self
):
img_sym
=
theano
.
tensor
.
tensor3
(
'img'
)
img_sym
=
theano
.
tensor
.
tensor3
(
'img'
)
kern_sym
=
theano
.
tensor
.
tensor3
(
'kern'
)
kern_sym
=
theano
.
tensor
.
tensor3
(
'kern'
)
if
not
theano
.
tensor
.
nnet
.
abstract_conv
.
imported_scipy_signal
:
raise
SkipTest
(
"SciPy needed"
)
sym_out
=
causal_conv1d
(
img_sym
,
kern_sym
,
self
.
kern
.
shape
,
filter_dilation
=
self
.
dilation
)
sym_out
=
causal_conv1d
(
img_sym
,
kern_sym
,
self
.
kern
.
shape
,
filter_dilation
=
self
.
dilation
)
causal_func
=
theano
.
function
([
img_sym
,
kern_sym
],
sym_out
,
mode
=
self
.
mode
)
causal_func
=
theano
.
function
([
img_sym
,
kern_sym
],
sym_out
,
mode
=
self
.
mode
)
...
...
theano/tensor/tests/_test_mpi_roundtrip.py
浏览文件 @
b56a541c
...
@@ -42,6 +42,7 @@ if rank == 0:
...
@@ -42,6 +42,7 @@ if rank == 0:
_
,
zz
=
f
(
xx
)
_
,
zz
=
f
(
xx
)
same
=
np
.
linalg
.
norm
(
zz
-
expected
)
<
.
001
same
=
np
.
linalg
.
norm
(
zz
-
expected
)
<
.
001
# The parent test will look for "True" in the output
stdout
.
write
(
str
(
same
))
stdout
.
write
(
str
(
same
))
if
rank
==
1
:
if
rank
==
1
:
...
...
theano/tensor/tests/test_mpi.py
浏览文件 @
b56a541c
from
__future__
import
absolute_import
,
print_function
,
division
from
__future__
import
absolute_import
,
print_function
,
division
from
theano.tensor.io
import
(
send
,
recv
,
mpi_cmps
,
MPISend
,
MPISendWait
,
mpi_send_wait_cmp
,
mpi_tag_cmp
,
mpi_enabled
)
import
theano
import
subprocess
import
os
import
os
from
theano.gof.sched
import
sort_schedule_fn
import
subprocess
from
theano
import
change_flags
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
import
theano
from
theano
import
change_flags
from
theano.compat
import
PY3
from
theano.gof.sched
import
sort_schedule_fn
from
theano.tensor.io
import
(
send
,
recv
,
mpi_cmps
,
MPISend
,
MPISendWait
,
mpi_send_wait_cmp
,
mpi_tag_cmp
,
mpi_enabled
)
mpi_scheduler
=
sort_schedule_fn
(
*
mpi_cmps
)
mpi_scheduler
=
sort_schedule_fn
(
*
mpi_cmps
)
mpi_linker
=
theano
.
OpWiseCLinker
(
schedule
=
mpi_scheduler
)
mpi_linker
=
theano
.
OpWiseCLinker
(
schedule
=
mpi_scheduler
)
mpi_mode
=
theano
.
Mode
(
linker
=
mpi_linker
)
mpi_mode
=
theano
.
Mode
(
linker
=
mpi_linker
)
...
@@ -45,15 +46,21 @@ def test_mpi_roundtrip():
...
@@ -45,15 +46,21 @@ def test_mpi_roundtrip():
if
not
mpi_enabled
:
if
not
mpi_enabled
:
raise
SkipTest
(
'MPI not enabled'
)
raise
SkipTest
(
'MPI not enabled'
)
theano_root
=
theano
.
__file__
.
split
(
'__init__'
)[
0
]
theano_root
=
theano
.
__file__
.
split
(
'__init__'
)[
0
]
d
=
{}
if
PY3
:
# Is some not understood cases, the subprocess never finish.
d
=
dict
(
timeout
=
5
*
60
)
p
=
subprocess
.
Popen
(
"mpiexec -np 2 python "
+
theano_root
+
p
=
subprocess
.
Popen
(
"mpiexec -np 2 python "
+
theano_root
+
"tensor/tests/_test_mpi_roundtrip.py"
,
"tensor/tests/_test_mpi_roundtrip.py"
,
stdin
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
,
shell
=
True
,
close_fds
=
True
)
close_fds
=
True
,
**
d
)
result
=
theano
.
compat
.
decode
(
p
.
stdout
.
read
())
(
stdout
,
stderr
)
=
p
.
communicate
()
assert
"True"
in
result
,
theano
.
compat
.
decode
(
p
.
stderr
.
read
())
result
=
theano
.
compat
.
decode
(
stdout
)
assert
"True"
in
result
,
theano
.
compat
.
decode
(
stderr
)
def
test_mpi_send_wait_cmp
():
def
test_mpi_send_wait_cmp
():
...
...
theano/tests/test_flake8.py
浏览文件 @
b56a541c
...
@@ -139,7 +139,7 @@ def test_format_flake8():
...
@@ -139,7 +139,7 @@ def test_format_flake8():
raise
AssertionError
(
"FLAKE8 Format not respected"
)
raise
AssertionError
(
"FLAKE8 Format not respected"
)
def
print_files_information_flake8
():
def
print_files_information_flake8
(
files
):
"""
"""
Print the list of files which can be removed from the whitelist and the
Print the list of files which can be removed from the whitelist and the
list of files which do not respect FLAKE8 formatting that aren't in the
list of files which do not respect FLAKE8 formatting that aren't in the
...
@@ -147,7 +147,9 @@ def print_files_information_flake8():
...
@@ -147,7 +147,9 @@ def print_files_information_flake8():
"""
"""
infracting_files
=
[]
infracting_files
=
[]
non_infracting_files
=
[]
non_infracting_files
=
[]
for
path
in
list_files
():
if
not
files
:
files
=
list_files
()
for
path
in
files
:
rel_path
=
os
.
path
.
relpath
(
path
,
theano
.
__path__
[
0
])
rel_path
=
os
.
path
.
relpath
(
path
,
theano
.
__path__
[
0
])
number_of_infractions
=
flake8
.
main
.
check_file
(
path
,
number_of_infractions
=
flake8
.
main
.
check_file
(
path
,
ignore
=
ignore
)
ignore
=
ignore
)
...
@@ -186,4 +188,4 @@ def check_all_files(dir_path=theano.__path__[0], pattern='*.py'):
...
@@ -186,4 +188,4 @@ def check_all_files(dir_path=theano.__path__[0], pattern='*.py'):
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
print_files_information_flake8
()
print_files_information_flake8
(
sys
.
argv
[
1
:]
)
theano/version.py
浏览文件 @
b56a541c
...
@@ -15,6 +15,9 @@ try:
...
@@ -15,6 +15,9 @@ try:
release
=
True
release
=
True
except
ValueError
:
except
ValueError
:
release
=
False
release
=
False
except
IndexError
:
print
(
short_version
)
raise
if
release
:
if
release
:
version
=
short_version
version
=
short_version
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论