提交 3ca711b7 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Flake8 for test_blas.py

上级 1e9d157c
...@@ -6,8 +6,7 @@ import numpy ...@@ -6,8 +6,7 @@ import numpy
import theano import theano
from theano import tensor from theano import tensor
from theano.tests import unittest_tools as utt from theano.tests import unittest_tools as utt
from theano.tensor.blas import (gemv_inplace, gemm_inplace, ger_destructive, from theano.tensor.blas import gemv_inplace, gemm_inplace, _dot22
_dot22)
from theano.tensor.tests.test_blas import TestGer, BaseGemv from theano.tensor.tests.test_blas import TestGer, BaseGemv
from .. import gpuarray_shared_constructor from .. import gpuarray_shared_constructor
...@@ -15,22 +14,22 @@ from .test_basic_ops import (makeTester, rand, ...@@ -15,22 +14,22 @@ from .test_basic_ops import (makeTester, rand,
mode_with_gpu) mode_with_gpu)
from ..blas import (gpugemv_inplace, gpugemv_no_inplace, from ..blas import (gpugemv_inplace, gpugemv_no_inplace,
gpugemm_inplace, gpugemm_no_inplace, gpugemm_inplace,
gpuger_inplace, gpuger_no_inplace, gpuger_inplace, gpuger_no_inplace,
GpuGer, gpu_dot22, GpuGemm) GpuGer, gpu_dot22, GpuGemm)
GpuGemvTester = makeTester('GpuGemvTester', GpuGemvTester = makeTester(
op=gemv_inplace, gpu_op=gpugemv_inplace, 'GpuGemvTester',
cases=dict( op=gemv_inplace, gpu_op=gpugemv_inplace,
dot_vv=[rand(1), 1, rand(1, 2), rand(2), 0], cases=dict(dot_vv=[rand(1), 1, rand(1, 2), rand(2), 0],
dot_vm=[rand(3), 1, rand(3, 2), rand(2), 0], dot_vm=[rand(3), 1, rand(3, 2), rand(2), 0],
# test_02=[rand(0), 1, rand(0, 2), rand(2), 0], # test_02=[rand(0), 1, rand(0, 2), rand(2), 0],
# test_30=[rand(3), 1, rand(3, 0), rand(0), 0], # test_30=[rand(3), 1, rand(3, 0), rand(0), 0],
# test_00=[rand(0), 1, rand(0, 0), rand(0), 0], # test_00=[rand(0), 1, rand(0, 0), rand(0), 0],
test_stride=[rand(3)[::-1], 1, rand(3, 2)[::-1], rand(2)[::-1], 0], test_stride=[rand(3)[::-1], 1, rand(3, 2)[::-1], rand(2)[::-1], 0],
) )
) )
class TestGpuSgemv(TestCase, BaseGemv, utt.TestOptimizationMixin): class TestGpuSgemv(TestCase, BaseGemv, utt.TestOptimizationMixin):
...@@ -48,24 +47,24 @@ class TestGpuSgemv(TestCase, BaseGemv, utt.TestOptimizationMixin): ...@@ -48,24 +47,24 @@ class TestGpuSgemv(TestCase, BaseGemv, utt.TestOptimizationMixin):
return theano.shared(val) return theano.shared(val)
GpuGemmTester = makeTester('GpuGemmTester', GpuGemmTester = makeTester(
op=gemm_inplace, gpu_op=gpugemm_inplace, 'GpuGemmTester',
cases=dict( op=gemm_inplace, gpu_op=gpugemm_inplace,
test1=[rand(3, 4), 1.0, rand(3, 5), rand(5, 4), 0.0], cases=dict(test1=[rand(3, 4), 1.0, rand(3, 5), rand(5, 4), 0.0],
test2=[rand(3, 4), 1.0, rand(3, 5), rand(5, 4), 1.0], test2=[rand(3, 4), 1.0, rand(3, 5), rand(5, 4), 1.0],
test3=[rand(3, 4), 1.0, rand(3, 5), rand(5, 4), -1.0], test3=[rand(3, 4), 1.0, rand(3, 5), rand(5, 4), -1.0],
test4=[rand(3, 4), 0.0, rand(3, 5), rand(5, 4), 0.0], test4=[rand(3, 4), 0.0, rand(3, 5), rand(5, 4), 0.0],
test5=[rand(3, 4), 0.0, rand(3, 5), rand(5, 4), 0.6], test5=[rand(3, 4), 0.0, rand(3, 5), rand(5, 4), 0.6],
test6=[rand(3, 4), 0.0, rand(3, 5), rand(5, 4), -1.0], test6=[rand(3, 4), 0.0, rand(3, 5), rand(5, 4), -1.0],
test7=[rand(3, 4), -1.0, rand(3, 5), rand(5, 4), 0.0], test7=[rand(3, 4), -1.0, rand(3, 5), rand(5, 4), 0.0],
test8=[rand(3, 4), -1.0, rand(3, 5), rand(5, 4), 1.1], test8=[rand(3, 4), -1.0, rand(3, 5), rand(5, 4), 1.1],
test9=[rand(3, 4), -1.0, rand(3, 5), rand(5, 4), -1.1], test9=[rand(3, 4), -1.0, rand(3, 5), rand(5, 4), -1.1],
# test10=[rand(0, 4), -1.0, rand(0, 5), rand(5, 4), 0.0], # test10=[rand(0, 4), -1.0, rand(0, 5), rand(5, 4), 0.0],
# test11=[rand(3, 0), -1.0, rand(3, 5), rand(5, 0), 1.1], # test11=[rand(3, 0), -1.0, rand(3, 5), rand(5, 0), 1.1],
# test12=[rand(3, 4), -1.0, rand(3, 0), rand(0, 4), -1.1], # test12=[rand(3, 4), -1.0, rand(3, 0), rand(0, 4), -1.1],
# test13=[rand(0, 0), -1.0, rand(0, 0), rand(0, 0), -1.1], # test13=[rand(0, 0), -1.0, rand(0, 0), rand(0, 0), -1.1],
) )
) )
class TestGpuSger(TestGer): class TestGpuSger(TestGer):
...@@ -84,8 +83,10 @@ class TestGpuSger(TestGer): ...@@ -84,8 +83,10 @@ class TestGpuSger(TestGer):
def test_f32_0_0(self): def test_f32_0_0(self):
raise SkipTest('0-sized objects not supported') raise SkipTest('0-sized objects not supported')
def test_f32_1_0(self): def test_f32_1_0(self):
raise SkipTest('0-sized objects not supported') raise SkipTest('0-sized objects not supported')
def test_f32_0_1(self): def test_f32_0_1(self):
raise SkipTest('0-sized objects not supported') raise SkipTest('0-sized objects not supported')
...@@ -103,21 +104,22 @@ class TestGpuGer_OpContract(TestCase, utt.T_OpContractMixin): ...@@ -103,21 +104,22 @@ class TestGpuGer_OpContract(TestCase, utt.T_OpContractMixin):
GpuDot22Tester = makeTester( GpuDot22Tester = makeTester(
'GpuGemmTester', 'GpuDot22Tester',
op=_dot22, gpu_op=gpu_dot22, op=_dot22, gpu_op=gpu_dot22,
cases=dict( cases=dict(
test1=[rand(3, 4), rand(4, 5)], test1=[rand(3, 4), rand(4, 5)],
test2=[rand(1, 4), rand(4, 5)], test2=[rand(1, 4), rand(4, 5)],
test3=[rand(3, 1), rand(1, 5)], test3=[rand(3, 1), rand(1, 5)],
test4=[rand(3, 4), rand(4, 1)], test4=[rand(3, 4), rand(4, 1)],
# test5=[rand(0, 4), rand(4, 5)], # test5=[rand(0, 4), rand(4, 5)],
# test6=[rand(3, 0), rand(0, 5)], # test6=[rand(3, 0), rand(0, 5)],
# test7=[rand(3, 4), rand(4, 0)], # test7=[rand(3, 4), rand(4, 0)],
# test8=[rand(0, 4), rand(4, 0)], # test8=[rand(0, 4), rand(4, 0)],
# test9=[rand(0, 0), rand(0, 0)], # test9=[rand(0, 0), rand(0, 0)],
) )
) )
def test_hgemm_swap(): def test_hgemm_swap():
from theano.sandbox.cuda import nvcc_compiler from theano.sandbox.cuda import nvcc_compiler
if nvcc_compiler.nvcc_version < '7.5': if nvcc_compiler.nvcc_version < '7.5':
...@@ -149,6 +151,7 @@ def test_hgemm_swap(): ...@@ -149,6 +151,7 @@ def test_hgemm_swap():
utt.assert_allclose(of, on) utt.assert_allclose(of, on)
def test_hgemm_alpha_output_merge(): def test_hgemm_alpha_output_merge():
from theano.sandbox.cuda import nvcc_compiler from theano.sandbox.cuda import nvcc_compiler
if nvcc_compiler.nvcc_version < '7.5': if nvcc_compiler.nvcc_version < '7.5':
......
...@@ -164,7 +164,6 @@ whitelist_flake8 = [ ...@@ -164,7 +164,6 @@ whitelist_flake8 = [
"sandbox/gpuarray/tests/test_conv_cuda_ndarray.py", "sandbox/gpuarray/tests/test_conv_cuda_ndarray.py",
"sandbox/gpuarray/tests/test_type.py", "sandbox/gpuarray/tests/test_type.py",
"sandbox/gpuarray/tests/test_opt.py", "sandbox/gpuarray/tests/test_opt.py",
"sandbox/gpuarray/tests/test_blas.py",
"sandbox/gpuarray/tests/test_elemwise.py", "sandbox/gpuarray/tests/test_elemwise.py",
"sandbox/gpuarray/tests/test_nnet.py", "sandbox/gpuarray/tests/test_nnet.py",
"scan_module/scan_utils.py", "scan_module/scan_utils.py",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论