Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
cac3e5b1
提交
cac3e5b1
authored
7月 07, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use pytest.importorskip with optional libraries
上级
f3e6e78e
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
52 行增加
和
62 行删除
+52
-62
setup.cfg
setup.cfg
+7
-1
test_abstractconv.py
theano/gpuarray/tests/test_abstractconv.py
+4
-2
test_basic_ops.py
theano/gpuarray/tests/test_basic_ops.py
+5
-7
test_cgpukernelbase.py
theano/gpuarray/tests/test_cgpukernelbase.py
+5
-3
test_dnn.py
theano/gpuarray/tests/test_dnn.py
+9
-14
test_elemwise.py
theano/gpuarray/tests/test_elemwise.py
+9
-18
test_others.py
theano/gpuarray/tests/test_others.py
+8
-9
test_pickle.py
theano/gpuarray/tests/test_pickle.py
+2
-6
test_type.py
theano/gpuarray/tests/test_type.py
+2
-1
test_opt.py
theano/sparse/tests/test_opt.py
+1
-1
没有找到文件。
setup.cfg
浏览文件 @
cac3e5b1
...
...
@@ -3,10 +3,16 @@ ignore=E501,E123,E133,FI12,FI14,FI15,FI50,FI51,FI53,W503,W504,E203,C901,E231,E74
per-file-ignores =
theano/sparse/sandbox/truedot.py:F401
theano/sparse/sandbox/sp2.py:F401
theano/gpuarray/tests/test_type.py:E402
theano/gpuarray/tests/test_abstractconv.py:E402
theano/gpuarray/tests/test_dnn.py:E402
theano/gpuarray/tests/test_elemwise.py:E402
theano/gpuarray/tests/test_others.py:E402
theano/gpuarray/tests/test_basic_ops.py:E402
exclude =
versioneer.py
doc/
__init__.py
,
__init__.py
theano/_version.py
[versioneer]
...
...
theano/gpuarray/tests/test_abstractconv.py
浏览文件 @
cac3e5b1
from
__future__
import
absolute_import
,
print_function
,
division
import
pytest
import
numpy
as
np
pygpu
=
pytest
.
importorskip
(
"pygpu"
)
gpuarray
=
pygpu
.
gpuarray
from
theano.tensor.nnet.tests.test_abstract_conv
import
(
BaseTestConv2d
,
BaseTestConv3d
,
...
...
@@ -22,7 +24,7 @@ from ..blas import (
)
from
.config
import
mode_with_gpu
,
test_ctx_name
from
pygpu
import
gpuarray
gpu_ftensor4
=
GpuArrayType
(
dtype
=
"float32"
,
broadcastable
=
(
False
,)
*
4
)
...
...
theano/gpuarray/tests/test_basic_ops.py
浏览文件 @
cac3e5b1
from
__future__
import
absolute_import
,
print_function
,
division
from
theano.compat
import
izip
import
pytest
from
six
import
iteritems
pygpu
=
pytest
.
importorskip
(
"pygpu"
)
gpuarray
=
pygpu
.
gpuarray
import
numpy
as
np
import
theano
import
theano.tensor
as
T
from
six
import
iteritems
from
theano.compat
import
izip
from
theano.tensor
import
TensorType
from
theano.tensor.basic
import
alloc
...
...
@@ -20,7 +22,6 @@ from theano.tensor.tests.test_basic import (
TestJoinAndSplit
,
)
from
theano.tests
import
unittest_tools
as
utt
from
..type
import
GpuArrayType
,
get_context
,
gpuarray_shared_constructor
from
..basic_ops
import
(
host_from_gpu
,
...
...
@@ -40,11 +41,8 @@ from ..basic_ops import (
)
from
..elemwise
import
GpuDimShuffle
,
GpuElemwise
from
..subtensor
import
GpuSubtensor
from
.config
import
mode_with_gpu
,
mode_without_gpu
,
test_ctx_name
from
pygpu
import
gpuarray
utt
.
seed_rng
()
rng
=
np
.
random
.
RandomState
(
seed
=
utt
.
fetch_seed
())
...
...
theano/gpuarray/tests/test_cgpukernelbase.py
浏览文件 @
cac3e5b1
from
__future__
import
division
,
absolute_import
,
print_function
import
pytest
import
numpy
as
np
import
theano
from
six.moves
import
xrange
import
theano
from
theano
import
tensor
,
config
,
Apply
,
Op
from
theano.scalar
import
int32
as
int_t
from
theano.gof
import
ParamsType
...
...
@@ -33,10 +35,10 @@ class GpuEye(CGpuKernelBase, Op):
)
def
get_params
(
self
,
node
):
from
pygpu.gpuarray
import
dtype_to_typecode
pygpu_gpuarray
=
pytest
.
importorskip
(
"pygpu.gpuarray"
)
return
self
.
params_type
.
get_params
(
typecode
=
dtype_to_typecode
(
self
.
dtype
),
typecode
=
pygpu_gpuarray
.
dtype_to_typecode
(
self
.
dtype
),
context
=
get_context
(
self
.
context_name
),
)
...
...
theano/gpuarray/tests/test_dnn.py
浏览文件 @
cac3e5b1
from
__future__
import
absolute_import
,
print_function
,
division
import
logging
from
collections
import
OrderedDict
import
numpy
as
np
import
pytest
from
itertools
import
product
,
chain
import
numpy
as
np
pygpu
=
pytest
.
importorskip
(
"pygpu"
)
import
theano
from
six
import
StringIO
import
theano.tensor
as
T
import
theano.tests.unittest_tools
as
utt
from
six
import
StringIO
from
itertools
import
product
,
chain
from
collections
import
OrderedDict
from
theano.tensor.signal.pool
import
pool_2d
,
pool_3d
from
theano.tensor.signal.pool
import
Pool
,
MaxPoolGrad
,
AveragePoolGrad
from
theano.tensor.nnet.abstract_conv
import
(
...
...
@@ -17,6 +18,9 @@ from theano.tensor.nnet.abstract_conv import (
get_conv_gradinputs_shape
,
)
from
theano.tensor.nnet
import
bn
from
theano.configdefaults
import
SUPPORTED_DNN_CONV_ALGO_FWD
from
theano.tensor.nnet.tests.test_abstract_conv
import
Grouped_conv_noOptim
from
theano.tensor.nnet.tests.test_abstract_conv
import
Grouped_conv3d_noOptim
from
..
import
dnn
from
..basic_ops
import
GpuAllocEmpty
...
...
@@ -26,15 +30,6 @@ from .config import mode_with_gpu, mode_without_gpu, test_ctx_name, ref_cast
from
.
import
test_nnet
from
.rnn_support
import
Model
,
GRU
,
LSTM
,
WrapperLayer
from
theano.configdefaults
import
SUPPORTED_DNN_CONV_ALGO_FWD
from
theano.tensor.nnet.tests.test_abstract_conv
import
Grouped_conv_noOptim
from
theano.tensor.nnet.tests.test_abstract_conv
import
Grouped_conv3d_noOptim
try
:
import
pygpu
except
ImportError
:
pass
mode_with_gpu
=
mode_with_gpu
.
including
()
# Globally disabled for mode_without_gpu
mode_with_gpu
.
check_py_code
=
False
...
...
theano/gpuarray/tests/test_elemwise.py
浏览文件 @
cac3e5b1
from
__future__
import
absolute_import
,
print_function
,
division
from
copy
import
copy
import
pytest
import
numpy
as
np
import
theano
pygpu
=
pytest
.
importorskip
(
"pygpu"
)
gpuarray
=
pygpu
.
ndgpuarray
from
copy
import
copy
from
theano
import
scalar
,
gof
,
tensor
from
theano.compile
import
DebugMode
,
Mode
from
theano.tests.unittest_tools
import
assert_allclose
...
...
@@ -25,17 +27,6 @@ from ..dnn import GpuDnnReduction
from
..type
import
GpuArrayType
,
get_context
,
gpuarray_shared_constructor
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
class
TestGpuBroadcast
(
test_elemwise
.
TestBroadcast
):
cop
=
GpuElemwise
...
...
@@ -96,8 +87,8 @@ class TestMathErrorFunctions:
@classmethod
def
setup_class
(
cls
):
if
not
imported_scipy_special
:
pytest
.
skip
(
"scipy.special needed"
)
scipy_special
=
pytest
.
importorskip
(
"scipy.special"
)
# 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
# (this will also allow to test some values outside the domains).
...
...
@@ -107,8 +98,8 @@ class TestMathErrorFunctions:
for
dtype
in
cls
.
dtypes
:
numpy_array
=
np
.
asarray
(
default_array
,
dtype
=
dtype
)
cls
.
default_arrays
[
dtype
]
=
numpy_array
cls
.
expected_erfinv_outputs
[
dtype
]
=
scipy
.
special
.
erfinv
(
numpy_array
)
cls
.
expected_erfcinv_outputs
[
dtype
]
=
scipy
.
special
.
erfcinv
(
numpy_array
)
cls
.
expected_erfinv_outputs
[
dtype
]
=
scipy
_
special
.
erfinv
(
numpy_array
)
cls
.
expected_erfcinv_outputs
[
dtype
]
=
scipy
_
special
.
erfcinv
(
numpy_array
)
# Since there are infinite values, we need to disable that check
# in DebugMode if needed
...
...
theano/gpuarray/tests/test_others.py
浏览文件 @
cac3e5b1
from
__future__
import
absolute_import
,
print_function
,
division
from
.config
import
test_ctx_name
,
mode_with_gpu
import
pytest
import
numpy
as
np
pygpu
=
pytest
.
importorskip
(
"pygpu"
)
from
theano.misc.tests.test_may_share_memory
import
may_share_memory_core
from
theano.misc.pkl_utils
import
dump
,
load
from
theano.tensor.tests
import
test_opt
from
.config
import
test_ctx_name
,
mode_with_gpu
from
..basic_ops
import
HostFromGpu
,
GpuFromHost
from
..type
import
(
get_context
,
...
...
@@ -9,14 +16,6 @@ from ..type import (
gpuarray_shared_constructor
,
)
import
pygpu
import
numpy
as
np
from
theano.misc.tests.test_may_share_memory
import
may_share_memory_core
from
theano.misc.pkl_utils
import
dump
,
load
from
theano.tensor.tests
import
test_opt
class
TestFusion
(
test_opt
.
TestFusion
):
mode
=
mode_with_gpu
.
excluding
(
"local_dnn_reduction"
)
...
...
theano/gpuarray/tests/test_pickle.py
浏览文件 @
cac3e5b1
...
...
@@ -19,19 +19,15 @@ from theano.misc.pkl_utils import CompatUnpickler
from
..type
import
ContextNotDefined
try
:
from
.
import
config
as
_
# noqa
import
pygpu
# noqa: F401
have_pygpu
=
True
except
ImportError
:
have_pygpu
=
False
@pytest.mark.skipif
(
have_pygpu
,
reason
=
"pygpu active"
)
def
test_unpickle_gpuarray_as_numpy_ndarray_flag1
():
# Only test when pygpu isn't
# available. test_unpickle_gpuarray_as_numpy_ndarray_flag0 in test_type.py
# test it when pygpu is there.
if
have_pygpu
:
pytest
.
skip
(
"pygpu active"
)
oldflag
=
config
.
experimental
.
unpickle_gpu_on_cpu
config
.
experimental
.
unpickle_gpu_on_cpu
=
False
...
...
theano/gpuarray/tests/test_type.py
浏览文件 @
cac3e5b1
...
...
@@ -3,7 +3,8 @@ import os
import
pytest
import
numpy
as
np
import
theano
import
pygpu
pygpu
=
pytest
.
importorskip
(
"pygpu"
)
from
theano.compat
import
PY3
from
theano
import
config
...
...
theano/sparse/tests/test_opt.py
浏览文件 @
cac3e5b1
...
...
@@ -3,7 +3,7 @@ import numpy as np
try
:
import
scipy.sparse
as
sp
import
scipy.sparse
import
scipy.sparse
# noqa: F401
except
ImportError
:
pass
# The variable enable_sparse will be used to disable the test file.
import
pytest
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论