提交 a3dbdec3 authored 作者: Brandon T. Willard's avatar Brandon T. Willard

Apply isort to tests.gpuarray sub-package modules

上级 88599bc3
...@@ -13,39 +13,26 @@ ...@@ -13,39 +13,26 @@
# Else, any arg will be directly passed to pytest. # Else, any arg will be directly passed to pytest.
# python check_dnn_conv.py -xvs # verbose mode, capture output, exit at first error. # python check_dnn_conv.py -xvs # verbose mode, capture output, exit at first error.
import sys
import math import math
import sys
import pytest from itertools import chain, product
import numpy as np import numpy as np
import pytest
import theano
import tests.unittest_tools as utt import tests.unittest_tools as utt
import theano
from itertools import product, chain from tests.gpuarray.config import mode_with_gpu, ref_cast
from theano.configdefaults import SUPPORTED_DNN_CONV_ALGO_RUNTIME from theano.configdefaults import SUPPORTED_DNN_CONV_ALGO_RUNTIME
from theano.gpuarray import cudnn_defs from theano.gpuarray import cudnn_defs
from theano.gpuarray.dnn import ( from theano.gpuarray.dnn import GpuDnnConv, GpuDnnConvGradI, GpuDnnConvGradW
GpuDnnConv, from theano.gpuarray.dnn import _dnn_conv as dnn_conv
GpuDnnConvGradW, from theano.gpuarray.dnn import _dnn_gradinput as dnn_gradinput
GpuDnnConvGradI, from theano.gpuarray.dnn import _dnn_gradweight as dnn_gradweight
version, from theano.gpuarray.dnn import version
_dnn_conv as dnn_conv, from theano.tensor.nnet.abstract_conv import assert_conv_shape, get_conv_output_shape
_dnn_gradinput as dnn_gradinput,
_dnn_gradweight as dnn_gradweight,
)
from theano.tensor.nnet.abstract_conv import get_conv_output_shape, assert_conv_shape
from theano.tensor.nnet.corr import CorrMM, CorrMM_gradInputs, CorrMM_gradWeights from theano.tensor.nnet.corr import CorrMM, CorrMM_gradInputs, CorrMM_gradWeights
from theano.tensor.nnet.corr3d import ( from theano.tensor.nnet.corr3d import Corr3dMM, Corr3dMMGradInputs, Corr3dMMGradWeights
Corr3dMM,
Corr3dMMGradInputs,
Corr3dMMGradWeights,
)
from tests.gpuarray.config import mode_with_gpu, ref_cast
def check_dtype_config_support(dtype, precision): def check_dtype_config_support(dtype, precision):
......
import pytest import pytest
import theano.tensor
import theano.gpuarray import theano.gpuarray
import theano.tensor
if theano.gpuarray.pygpu is None: if theano.gpuarray.pygpu is None:
......
...@@ -2,30 +2,23 @@ ...@@ -2,30 +2,23 @@
# This script should not be imported, but only used as a program. # This script should not be imported, but only used as a program.
# python run_dnn_conv.py --help # Print help. # python run_dnn_conv.py --help # Print help.
# python run_dnn_conv.py {fwd|bwd-filter|bwd-data} {2d|3d} -a <algo> -i <inputShape> -f <filterShape> ... # python run_dnn_conv.py {fwd|bwd-filter|bwd-data} {2d|3d} -a <algo> -i <inputShape> -f <filterShape> ...
import sys
import argparse import argparse
import sys
import theano import theano
from tests.gpuarray.check_dnn_conv import CheckDnn, TestDnnConv2D, TestDnnConv3D, cudnn
from theano.configdefaults import SUPPORTED_DNN_CONV_ALGO_RUNTIME from theano.configdefaults import SUPPORTED_DNN_CONV_ALGO_RUNTIME
from theano.gpuarray.cudnn_defs import ( from theano.gpuarray.cudnn_defs import (
HALF,
FLOAT,
DOUBLE, DOUBLE,
TRUE_HALF_CONFIG,
PSEUDO_HALF_CONFIG,
FLOAT_CONFIG,
DOUBLE_CONFIG, DOUBLE_CONFIG,
FLOAT,
FLOAT_CONFIG,
HALF,
PSEUDO_HALF_CONFIG,
TRUE_HALF_CONFIG,
) )
from theano.tensor.nnet.abstract_conv import get_conv_output_shape from theano.tensor.nnet.abstract_conv import get_conv_output_shape
from tests.gpuarray.check_dnn_conv import (
cudnn,
TestDnnConv2D,
TestDnnConv3D,
CheckDnn,
)
if __name__ != "__main__": if __name__ != "__main__":
raise ImportError("This script must not be imported.") raise ImportError("This script must not be imported.")
......
import numpy as np
import pytest import pytest
import numpy as np
pygpu = pytest.importorskip("pygpu") pygpu = pytest.importorskip("pygpu")
gpuarray = pygpu.gpuarray gpuarray = pygpu.gpuarray
from theano.gpuarray.type import GpuArrayType, gpuarray_shared_constructor, get_context from tests.gpuarray.config import mode_with_gpu, test_ctx_name
from theano.gpuarray.dnn import ( from tests.tensor.nnet.test_abstract_conv import (
dnn_available, BaseTestConv2d,
GpuDnnConv, BaseTestConv3d,
GpuDnnConvGradW, TestConv2dTranspose,
GpuDnnConvGradI, TestConvTypes,
) )
from theano.gpuarray.blas import ( from theano.gpuarray.blas import (
GpuCorrMM,
GpuCorrMM_gradWeights,
GpuCorrMM_gradInputs,
GpuCorr3dMM, GpuCorr3dMM,
GpuCorr3dMM_gradWeights,
GpuCorr3dMM_gradInputs, GpuCorr3dMM_gradInputs,
GpuCorr3dMM_gradWeights,
GpuCorrMM,
GpuCorrMM_gradInputs,
GpuCorrMM_gradWeights,
) )
from theano.gpuarray.dnn import (
from tests.tensor.nnet.test_abstract_conv import ( GpuDnnConv,
BaseTestConv2d, GpuDnnConvGradI,
BaseTestConv3d, GpuDnnConvGradW,
TestConvTypes, dnn_available,
TestConv2dTranspose,
) )
from tests.gpuarray.config import mode_with_gpu, test_ctx_name from theano.gpuarray.type import GpuArrayType, get_context, gpuarray_shared_constructor
gpu_ftensor4 = GpuArrayType(dtype="float32", broadcastable=(False,) * 4) gpu_ftensor4 = GpuArrayType(dtype="float32", broadcastable=(False,) * 4)
......
import pytest import pytest
pygpu = pytest.importorskip("pygpu") pygpu = pytest.importorskip("pygpu")
gpuarray = pygpu.gpuarray gpuarray = pygpu.gpuarray
import numpy as np import numpy as np
import theano import theano
import theano.tensor as tt import theano.tensor as tt
from tests import unittest_tools as utt
from theano.tensor import TensorType from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, test_ctx_name
from theano.tensor.basic import alloc from tests.tensor.test_basic import (
TestAlloc,
# Don't import test classes otherwise they get tested as part of the file TestComparison,
from theano.gpuarray.type import GpuArrayType, get_context, gpuarray_shared_constructor TestJoinAndSplit,
TestReshape,
rand,
safe_make_node,
)
from theano.gpuarray.basic_ops import ( from theano.gpuarray.basic_ops import (
host_from_gpu,
HostFromGpu,
GpuFromHost,
GpuReshape,
GpuToGpu,
GpuAlloc, GpuAlloc,
GpuAllocEmpty, GpuAllocEmpty,
GpuContiguous, GpuContiguous,
gpu_join, GpuEye,
GpuFromHost,
GpuJoin, GpuJoin,
GpuReshape,
GpuSplit, GpuSplit,
GpuEye, GpuToGpu,
GpuTri, GpuTri,
HostFromGpu,
gpu_contiguous, gpu_contiguous,
gpu_join,
host_from_gpu,
) )
from theano.gpuarray.elemwise import GpuDimShuffle, GpuElemwise from theano.gpuarray.elemwise import GpuDimShuffle, GpuElemwise
from theano.gpuarray.subtensor import GpuSubtensor from theano.gpuarray.subtensor import GpuSubtensor
from tests import unittest_tools as utt # Don't import test classes otherwise they get tested as part of the file
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, test_ctx_name from theano.gpuarray.type import GpuArrayType, get_context, gpuarray_shared_constructor
from tests.tensor.test_basic import ( from theano.tensor import TensorType
rand, from theano.tensor.basic import alloc
safe_make_node,
TestAlloc,
TestComparison,
TestReshape,
TestJoinAndSplit,
)
utt.seed_rng() utt.seed_rng()
...@@ -68,7 +68,7 @@ def inplace_func( ...@@ -68,7 +68,7 @@ def inplace_func(
def fake_shared(value, name=None, strict=False, allow_downcast=None, **kwargs): def fake_shared(value, name=None, strict=False, allow_downcast=None, **kwargs):
from theano.tensor.sharedvar import tensor_constructor, scalar_constructor from theano.tensor.sharedvar import scalar_constructor, tensor_constructor
for c in (gpuarray_shared_constructor, tensor_constructor, scalar_constructor): for c in (gpuarray_shared_constructor, tensor_constructor, scalar_constructor):
try: try:
......
import itertools import itertools
import numpy as np import numpy as np
import theano import theano
from theano import config from tests import unittest_tools as utt
from theano import tensor from tests.gpuarray.config import mode_with_gpu, test_ctx_name
from theano.tensor.blas import gemv, gemv_inplace, gemm_inplace, _dot22, batched_dot from tests.gpuarray.test_basic_ops import makeTester, rand
from tests.tensor.test_blas import BaseGemv, TestGer
from theano import config, tensor
from theano.gpuarray import gpuarray_shared_constructor from theano.gpuarray import gpuarray_shared_constructor
from theano.gpuarray.blas import ( from theano.gpuarray.blas import (
gpugemv_inplace, GpuGemm,
gpugemv_no_inplace, GpuGer,
gpu_dot22,
gpugemm_inplace, gpugemm_inplace,
gpugemm_no_inplace, gpugemm_no_inplace,
gpugemmbatch_inplace, gpugemmbatch_inplace,
gpugemv_inplace,
gpugemv_no_inplace,
gpuger_inplace, gpuger_inplace,
gpuger_no_inplace, gpuger_no_inplace,
GpuGer,
GpuGemm,
gpu_dot22,
) )
from theano.tensor.blas import _dot22, batched_dot, gemm_inplace, gemv, gemv_inplace
from tests import unittest_tools as utt
from tests.tensor.test_blas import TestGer, BaseGemv
from tests.gpuarray.config import mode_with_gpu, test_ctx_name
from tests.gpuarray.test_basic_ops import makeTester, rand
TestGpuGemv = makeTester( TestGpuGemv = makeTester(
......
import pytest
import numpy as np import numpy as np
import pytest
import theano
import tests.unittest_tools as utt import tests.unittest_tools as utt
import theano
from tests.gpuarray.config import mode_with_gpu, test_ctx_name
from tests.tensor.nnet.test_blocksparse import TestBlockSparseGemvAndOuter
from theano import tensor from theano import tensor
from theano.gpuarray.type import gpuarray_shared_constructor
from theano.gpuarray.blocksparse import ( from theano.gpuarray.blocksparse import (
GpuSparseBlockGemv, GpuSparseBlockGemv,
GpuSparseBlockOuter, GpuSparseBlockOuter,
gpu_sparse_block_gemv, gpu_sparse_block_gemv,
gpu_sparse_block_outer, gpu_sparse_block_outer,
) )
from theano.gpuarray.type import gpuarray_shared_constructor
from tests.gpuarray.config import mode_with_gpu, test_ctx_name
from tests.tensor.nnet.test_blocksparse import TestBlockSparseGemvAndOuter
class TestBlockSparseGemvAndOuterGPUarray(TestBlockSparseGemvAndOuter): class TestBlockSparseGemvAndOuterGPUarray(TestBlockSparseGemvAndOuter):
......
import pytest
import numpy as np import numpy as np
import theano import pytest
from theano import tensor, config, Apply, Op import theano
from theano.scalar import int32 as int_t from theano import Apply, Op, config, tensor
from theano.gof import ParamsType from theano.gof import ParamsType
from theano.gradient import grad_undefined
from theano.gpuarray.basic_ops import CGpuKernelBase from theano.gpuarray.basic_ops import CGpuKernelBase
from theano.gpuarray.type import GpuArrayType, get_context, gpu_context_type from theano.gpuarray.type import GpuArrayType, get_context, gpu_context_type
from theano.gradient import grad_undefined
from theano.scalar import int32 as int_t
# This is an implementation to test that CGpuKernelBase works and also # This is an implementation to test that CGpuKernelBase works and also
......
import pytest
import numpy as np import numpy as np
import pytest
import theano import theano
import theano.tensor as tt
import theano.gpuarray import theano.gpuarray
import theano.tensor as tt
from theano.gpuarray.ctc import gpu_ctc, GpuConnectionistTemporalClassification from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu
from tests.tensor.nnet.test_ctc import setup_ctc_case, setup_grad_case, setup_torch_case
from theano.gpuarray.ctc import GpuConnectionistTemporalClassification, gpu_ctc
from theano.tensor.nnet.ctc import ( from theano.tensor.nnet.ctc import (
ConnectionistTemporalClassification,
ctc, ctc,
ctc_available, ctc_available,
ConnectionistTemporalClassification,
)
from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu
from tests.tensor.nnet.test_ctc import (
setup_torch_case,
setup_ctc_case,
setup_grad_case,
) )
......
import logging import logging
import pytest
import numpy as np import numpy as np
import pytest
pygpu = pytest.importorskip("pygpu") # noqa
import theano pygpu = pytest.importorskip("pygpu") # noqa
import theano.tensor as tt
import tests.unittest_tools as utt
from itertools import product, chain
from collections import OrderedDict from collections import OrderedDict
from itertools import chain, product
from six import StringIO from six import StringIO
import tests.unittest_tools as utt
import theano
import theano.tensor as tt
from tests.gpuarray import test_nnet
from tests.gpuarray.config import (
mode_with_gpu,
mode_without_gpu,
ref_cast,
test_ctx_name,
)
from tests.gpuarray.rnn_support import GRU, LSTM, Model, WrapperLayer
from tests.tensor.nnet.test_abstract_conv import (
TestGroupedConv3dNoOptim,
TestGroupedConvNoOptim,
)
from theano.configdefaults import SUPPORTED_DNN_CONV_ALGO_FWD
from theano.gpuarray import dnn
from theano.gpuarray.basic_ops import GpuAllocEmpty
from theano.gpuarray.type import GpuArrayType, gpuarray_shared_constructor
from theano.tensor.nnet import ( from theano.tensor.nnet import (
bn,
softmax_op,
SoftmaxGrad,
softmax,
LogSoftmax, LogSoftmax,
Softmax, Softmax,
SoftmaxGrad,
bn,
conv2d, conv2d,
softmax,
softmax_op,
) )
from theano.tensor.nnet.corr3d import Corr3dMM
from theano.tensor.nnet.corr import CorrMM
from theano.tensor.nnet.abstract_conv import ( from theano.tensor.nnet.abstract_conv import (
get_conv_output_shape,
get_conv_gradinputs_shape, get_conv_gradinputs_shape,
get_conv_output_shape,
) )
from theano.tensor.signal.pool import pool_2d, pool_3d from theano.tensor.nnet.corr import CorrMM
from theano.tensor.signal.pool import Pool, MaxPoolGrad, AveragePoolGrad from theano.tensor.nnet.corr3d import Corr3dMM
from theano.tensor.signal.pool import (
from theano.configdefaults import SUPPORTED_DNN_CONV_ALGO_FWD AveragePoolGrad,
MaxPoolGrad,
from theano.gpuarray import dnn Pool,
from theano.gpuarray.basic_ops import GpuAllocEmpty pool_2d,
from theano.gpuarray.type import gpuarray_shared_constructor, GpuArrayType pool_3d,
from tests.tensor.nnet.test_abstract_conv import (
TestGroupedConvNoOptim,
TestGroupedConv3dNoOptim,
)
from tests.gpuarray import test_nnet
from tests.gpuarray.config import (
mode_with_gpu,
mode_without_gpu,
test_ctx_name,
ref_cast,
) )
from tests.gpuarray.rnn_support import Model, GRU, LSTM, WrapperLayer
if not dnn.dnn_available(test_ctx_name): if not dnn.dnn_available(test_ctx_name):
......
import pytest
import numpy as np import numpy as np
import pytest
import theano import theano
pygpu = pytest.importorskip("pygpu") pygpu = pytest.importorskip("pygpu")
gpuarray = pygpu.ndgpuarray gpuarray = pygpu.ndgpuarray
from copy import copy from copy import copy
from theano import scalar, gof, tensor from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, test_ctx_name
from tests.gpuarray.test_basic_ops import rand_gpuarray
from tests.tensor import test_elemwise
from tests.unittest_tools import assert_allclose
from theano import gof, scalar, tensor
from theano.compile import DebugMode, Mode from theano.compile import DebugMode, Mode
from theano.gpuarray.dnn import GpuDnnReduction
from theano.gpuarray.elemwise import ( from theano.gpuarray.elemwise import (
GpuElemwise,
GpuDimShuffle,
GpuCAReduceCuda,
GpuCAReduceCPY, GpuCAReduceCPY,
GpuErfinv, GpuCAReduceCuda,
GpuDimShuffle,
GpuElemwise,
GpuErfcinv, GpuErfcinv,
GpuErfinv,
) )
from theano.gpuarray.dnn import GpuDnnReduction
from theano.gpuarray.type import GpuArrayType, get_context, gpuarray_shared_constructor from theano.gpuarray.type import GpuArrayType, get_context, gpuarray_shared_constructor
from tests.tensor import test_elemwise
from tests.unittest_tools import assert_allclose
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, test_ctx_name
from tests.gpuarray.test_basic_ops import rand_gpuarray
# This is actually a test for GpuElemwise # This is actually a test for GpuElemwise
class TestGpuBroadcast(test_elemwise.TestBroadcast): class TestGpuBroadcast(test_elemwise.TestBroadcast):
......
import pytest from functools import partial
from itertools import product
import numpy as np import numpy as np
import pytest
import theano import theano
import theano.tensor as tt import theano.tensor as tt
from functools import partial
from itertools import product
from theano.tensor.extra_ops import CumOp
from theano.gpuarray.extra_ops import GpuCumOp
from theano.gpuarray.type import get_context
from tests import unittest_tools as utt from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, test_ctx_name from tests.gpuarray.config import mode_with_gpu, test_ctx_name
from tests.tensor.test_extra_ops import TestCumOp from tests.tensor.test_extra_ops import TestCumOp
from theano.gpuarray.extra_ops import GpuCumOp
from theano.gpuarray.type import get_context
from theano.tensor.extra_ops import CumOp
class TestGpuCumOp(TestCumOp): class TestGpuCumOp(TestCumOp):
......
import numpy as np import numpy as np
import pytest import pytest
import theano import theano
import theano.tensor as tt
import theano.gpuarray.fft import theano.gpuarray.fft
import theano.tensor as tt
from theano.gpuarray.fft import pygpu_available, skcuda_available, pycuda_available
from tests import unittest_tools as utt from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu from tests.gpuarray.config import mode_with_gpu
from theano.gpuarray.fft import pycuda_available, pygpu_available, skcuda_available
# Skip tests if pygpu is not available. # Skip tests if pygpu is not available.
if not pygpu_available: # noqa if not pygpu_available: # noqa
......
import numpy as np import numpy as np
import theano import theano
from theano import config
from theano.tensor.nnet.corr import CorrMM, CorrMM_gradWeights, CorrMM_gradInputs
from theano.gpuarray.type import gpuarray_shared_constructor
from theano.gpuarray.blas import GpuCorrMM, GpuCorrMM_gradWeights, GpuCorrMM_gradInputs
from tests import unittest_tools as utt from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, ref_cast from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, ref_cast
from tests.tensor.nnet.test_abstract_conv import (
TestGroupedConvNoOptim,
TestUnsharedConv,
)
from tests.tensor.nnet.test_abstract_conv import ( from tests.tensor.nnet.test_abstract_conv import (
TestAsymmetricPadding, TestAsymmetricPadding,
TestCausalConv, TestCausalConv,
TestGroupedConvNoOptim,
TestUnsharedConv,
) )
from theano import config
from theano.gpuarray.blas import GpuCorrMM, GpuCorrMM_gradInputs, GpuCorrMM_gradWeights
from theano.gpuarray.type import gpuarray_shared_constructor
from theano.tensor.nnet.corr import CorrMM, CorrMM_gradInputs, CorrMM_gradWeights
class TestCorrMM: class TestCorrMM:
......
import numpy as np import numpy as np
import theano import theano
from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, ref_cast
from tests.tensor.nnet.test_abstract_conv import TestGroupedConv3dNoOptim
from theano import config from theano import config
from theano.tensor.nnet.corr3d import (
Corr3dMM,
Corr3dMMGradWeights,
Corr3dMMGradInputs,
)
from theano.gpuarray.type import gpuarray_shared_constructor
from theano.gpuarray.blas import ( from theano.gpuarray.blas import (
GpuCorr3dMM, GpuCorr3dMM,
GpuCorr3dMM_gradWeights,
GpuCorr3dMM_gradInputs, GpuCorr3dMM_gradInputs,
GpuCorr3dMM_gradWeights,
) )
from theano.gpuarray.type import gpuarray_shared_constructor
from tests import unittest_tools as utt from theano.tensor.nnet.corr3d import Corr3dMM, Corr3dMMGradInputs, Corr3dMMGradWeights
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, ref_cast
from tests.tensor.nnet.test_abstract_conv import TestGroupedConv3dNoOptim
class TestCorr3dMM: class TestCorr3dMM:
......
import pytest
import numpy as np import numpy as np
import pytest
import theano
from numpy.linalg.linalg import LinAlgError from numpy.linalg.linalg import LinAlgError
import theano
from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu
from tests.gpuarray.test_basic_ops import rand
from theano import config from theano import config
from theano.gpuarray import gpuarray_shared_constructor
from theano.gpuarray.linalg import ( from theano.gpuarray.linalg import (
GpuCusolverSolve,
GpuCublasTriangularSolve,
GpuCholesky, GpuCholesky,
GpuCublasTriangularSolve,
GpuCusolverSolve,
GpuMagmaCholesky, GpuMagmaCholesky,
GpuMagmaEigh, GpuMagmaEigh,
GpuMagmaMatrixInverse, GpuMagmaMatrixInverse,
GpuMagmaQR, GpuMagmaQR,
GpuMagmaSVD, GpuMagmaSVD,
cusolver_available, cusolver_available,
gpu_matrix_inverse,
gpu_cholesky, gpu_cholesky,
gpu_matrix_inverse,
gpu_qr,
gpu_solve, gpu_solve,
gpu_solve_lower_triangular, gpu_solve_lower_triangular,
gpu_svd, gpu_svd,
gpu_qr,
) )
from theano.tensor.nlinalg import ( from theano.tensor.nlinalg import (
SVD, SVD,
...@@ -34,11 +35,6 @@ from theano.tensor.nlinalg import ( ...@@ -34,11 +35,6 @@ from theano.tensor.nlinalg import (
qr, qr,
) )
from theano.tensor.slinalg import Cholesky, cholesky, imported_scipy from theano.tensor.slinalg import Cholesky, cholesky, imported_scipy
from theano.gpuarray import gpuarray_shared_constructor
from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu
from tests.gpuarray.test_basic_ops import rand
@pytest.mark.skipif( @pytest.mark.skipif(
......
...@@ -3,12 +3,10 @@ ...@@ -3,12 +3,10 @@
import numpy as np import numpy as np
import theano import theano
from tests.gpuarray.config import mode_with_gpu
from theano import tensor from theano import tensor
from theano.compile.nanguardmode import NanGuardMode from theano.compile.nanguardmode import NanGuardMode
from tests.gpuarray.config import mode_with_gpu
def test_nan_guard_mode(): def test_nan_guard_mode():
# Also test that abs uint* and bool have c code. # Also test that abs uint* and bool have c code.
......
import os import os
from pickle import Unpickler
import pytest
import numpy as np import numpy as np
import pytest
import theano
import tests.unittest_tools as utt import tests.unittest_tools as utt
import theano
from pickle import Unpickler from tests.gpuarray.config import mode_with_gpu
from theano import config, function, tensor from theano import config, function, tensor
from theano.compat import PY3 from theano.compat import PY3
from theano.sandbox import multinomial
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from theano.gpuarray.multinomial import ( from theano.gpuarray.multinomial import (
GPUAMultinomialFromUniform,
GPUAChoiceFromUniform, GPUAChoiceFromUniform,
GPUAMultinomialFromUniform,
) )
from theano.sandbox import multinomial
from tests.gpuarray.config import mode_with_gpu from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
def test_multinomial_output_dtype(): def test_multinomial_output_dtype():
......
from theano.gpuarray.neighbours import GpuImages2Neibs
from tests.tensor.nnet import test_neighbours
from tests.gpuarray.config import mode_with_gpu from tests.gpuarray.config import mode_with_gpu
from tests.tensor.nnet import test_neighbours
from theano.gpuarray.neighbours import GpuImages2Neibs
class TestGpuImages2Neibs(test_neighbours.TestImages2Neibs): class TestGpuImages2Neibs(test_neighbours.TestImages2Neibs):
......
import numpy as np import numpy as np
import tests.unittest_tools as utt
import theano import theano
import theano.tensor as tt import theano.tensor as tt
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu
import tests.unittest_tools as utt
from theano.tensor.nnet import crossentropy_softmax_1hot_with_bias_dx
from theano.gpuarray.nnet import ( from theano.gpuarray.nnet import (
GpuCrossentropySoftmaxArgmax1HotWithBias,
GpuCrossentropySoftmax1HotWithBiasDx, GpuCrossentropySoftmax1HotWithBiasDx,
GpuSoftmaxWithBias, GpuCrossentropySoftmaxArgmax1HotWithBias,
GpuSoftmax, GpuSoftmax,
GpuSoftmaxWithBias,
) )
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu from theano.tensor.nnet import crossentropy_softmax_1hot_with_bias_dx
mode_wo_cudnn = mode_with_gpu.excluding("cudnn") mode_wo_cudnn = mode_with_gpu.excluding("cudnn")
......
import numpy as np import numpy as np
import pytest import pytest
import theano import theano
import theano.gpuarray import theano.gpuarray
import theano.tensor.slinalg as slinalg import theano.tensor.slinalg as slinalg
from tests import test_ifelse
from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, test_ctx_name
from tests.tensor import test_basic
from theano import tensor from theano import tensor
from theano.gof.opt import check_stack_trace
from theano.tensor.nnet import abstract_conv
from theano.breakpoint import PdbBreakpoint from theano.breakpoint import PdbBreakpoint
from theano.gpuarray import basic_ops from theano.gof.opt import check_stack_trace
from theano.gpuarray.type import GpuArrayType, gpuarray_shared_constructor, get_context from theano.gpuarray import basic_ops, blas, dnn, opt
from theano.gpuarray.basic_ops import ( from theano.gpuarray.basic_ops import (
GpuAlloc, GpuAlloc,
GpuAllocEmpty, GpuAllocEmpty,
GpuReshape,
GpuFromHost, GpuFromHost,
GpuReshape,
HostFromGpu, HostFromGpu,
host_from_gpu, host_from_gpu,
) )
from theano.gpuarray.blas import GpuGemm from theano.gpuarray.blas import GpuGemm
from theano.gpuarray.dnn import GpuDnnReduction
from theano.gpuarray.elemwise import ( from theano.gpuarray.elemwise import (
GpuCAReduceCuda, Elemwise,
GpuCAReduceCPY, GpuCAReduceCPY,
GpuCAReduceCuda,
GpuElemwise, GpuElemwise,
Elemwise,
max_inputs_to_GpuElemwise, max_inputs_to_GpuElemwise,
) )
from theano.gpuarray import dnn, blas, opt from theano.gpuarray.linalg import GpuCholesky, GpuCusolverSolve, cusolver_available
from theano.gpuarray.dnn import GpuDnnReduction
from theano.gpuarray.subtensor import GpuSubtensor from theano.gpuarray.subtensor import GpuSubtensor
from theano.gpuarray.linalg import GpuCusolverSolve, cusolver_available, GpuCholesky from theano.gpuarray.type import GpuArrayType, get_context, gpuarray_shared_constructor
from theano.tensor.nnet import abstract_conv
from tests import unittest_tools as utt, test_ifelse
from tests.tensor import test_basic
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu, test_ctx_name
def _check_stack_trace(thing): def _check_stack_trace(thing):
......
import pytest
import numpy as np import numpy as np
import pytest
pygpu = pytest.importorskip("pygpu") pygpu = pytest.importorskip("pygpu")
from theano.misc.pkl_utils import dump, load from tests.gpuarray.config import mode_with_gpu, test_ctx_name
from theano.gpuarray.basic_ops import HostFromGpu, GpuFromHost from tests.misc.test_may_share_memory import may_share_memory_core
from tests.tensor import test_opt
from theano.gpuarray.basic_ops import GpuFromHost, HostFromGpu
from theano.gpuarray.type import ( from theano.gpuarray.type import (
get_context,
GpuArrayType,
GpuArraySharedVariable, GpuArraySharedVariable,
GpuArrayType,
get_context,
gpuarray_shared_constructor, gpuarray_shared_constructor,
) )
from theano.misc.pkl_utils import dump, load
from tests.tensor import test_opt
from tests.misc.test_may_share_memory import may_share_memory_core
from tests.gpuarray.config import test_ctx_name, mode_with_gpu
class TestFusion(test_opt.TestFusion): class TestFusion(test_opt.TestFusion):
......
...@@ -8,17 +8,15 @@ regular test file. ...@@ -8,17 +8,15 @@ regular test file.
import os import os
import sys import sys
from pickle import Unpickler
import pytest
import numpy as np import numpy as np
import pytest
from pickle import Unpickler
from theano import config from theano import config
from theano.gpuarray.type import ContextNotDefined from theano.gpuarray.type import ContextNotDefined
try: try:
import pygpu # noqa: F401 import pygpu # noqa: F401
......
import copy import copy
import itertools import itertools
import pytest
import numpy as np import numpy as np
import pytest
import theano import theano
from tests import unittest_tools as utt
from theano import gradient from tests.gpuarray.config import mode_with_gpu, mode_without_gpu
from theano import tensor from tests.gpuarray.test_basic_ops import rand
from theano.tensor.signal.pool import ( from theano import gradient, tensor
Pool,
MaxPoolGrad,
AveragePoolGrad,
DownsampleFactorMaxGradGrad,
)
from theano.gpuarray.pool import ( from theano.gpuarray.pool import (
GpuPool,
GpuMaxPoolGrad,
GpuAveragePoolGrad, GpuAveragePoolGrad,
GpuDownsampleFactorMaxGradGrad, GpuDownsampleFactorMaxGradGrad,
GpuMaxPoolGrad,
GpuPool,
)
from theano.tensor.signal.pool import (
AveragePoolGrad,
DownsampleFactorMaxGradGrad,
MaxPoolGrad,
Pool,
) )
from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu
from tests.gpuarray.test_basic_ops import rand
class TestPool: class TestPool:
......
import math import math
import pytest
import numpy as np import numpy as np
import pytest
import theano import theano
import theano.tensor as tt import theano.tensor as tt
from theano.gpuarray import GpuArrayType
from theano.gpuarray.reduction import GpuMaxAndArgmax
from theano.gpuarray.dnn import GpuDnnReduction
from tests import unittest_tools as utt from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, mode_without_gpu from tests.gpuarray.config import mode_with_gpu, mode_without_gpu
from tests.gpuarray.test_basic_ops import rand_gpuarray from tests.gpuarray.test_basic_ops import rand_gpuarray
from theano.gpuarray import GpuArrayType
from theano.gpuarray.dnn import GpuDnnReduction
from theano.gpuarray.reduction import GpuMaxAndArgmax
# Number of values to be used in test tensors (except with 0-D tensors!). # Number of values to be used in test tensors (except with 0-D tensors!).
......
...@@ -3,17 +3,15 @@ import functools ...@@ -3,17 +3,15 @@ import functools
import numpy as np import numpy as np
import theano import theano
from theano import change_flags, tensor
from theano.sandbox import rng_mrg
from theano.sandbox.rng_mrg import MRG_RandomStreams
from theano.gpuarray.type import gpuarray_shared_constructor
from theano.gpuarray.rng_mrg import GPUA_mrg_uniform
from tests import unittest_tools as utt from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu as mode from tests.gpuarray.config import mode_with_gpu as mode
from tests.sandbox.test_rng_mrg import java_samples, rng_mrg_overflow from tests.sandbox.test_rng_mrg import java_samples, rng_mrg_overflow
from tests.sandbox.test_rng_mrg import test_f16_nonzero as cpu_f16_nonzero from tests.sandbox.test_rng_mrg import test_f16_nonzero as cpu_f16_nonzero
from theano import change_flags, tensor
from theano.gpuarray.rng_mrg import GPUA_mrg_uniform
from theano.gpuarray.type import gpuarray_shared_constructor
from theano.sandbox import rng_mrg
from theano.sandbox.rng_mrg import MRG_RandomStreams
utt.seed_rng() utt.seed_rng()
......
import numpy as np import numpy as np
import theano import theano
import theano.sandbox.rng_mrg import theano.sandbox.rng_mrg
from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, test_ctx_name from tests.gpuarray.config import mode_with_gpu, test_ctx_name
from theano.gpuarray.basic_ops import GpuFromHost, HostFromGpu from theano.gpuarray.basic_ops import GpuFromHost, HostFromGpu
from theano.gpuarray.elemwise import GpuElemwise from theano.gpuarray.elemwise import GpuElemwise
from tests import unittest_tools as utt
class TestScan: class TestScan:
def setup_method(self): def setup_method(self):
......
from theano.gpuarray.sort import GpuTopKOp
from tests.tensor.test_sort import TestTopK
from tests.gpuarray.config import mode_with_gpu from tests.gpuarray.config import mode_with_gpu
from tests.tensor.test_sort import TestTopK
from theano.gpuarray.sort import GpuTopKOp
class TestGpuTopK(TestTopK): class TestGpuTopK(TestTopK):
......
import numpy as np import numpy as np
import theano import theano
from tests import unittest_tools as utt
from tests.gpuarray.config import mode_with_gpu, test_ctx_name
from tests.tensor.test_basic import TestAllocDiag
from tests.tensor.test_subtensor import TestAdvancedSubtensor, TestSubtensor
from theano import tensor from theano import tensor
from theano.compile import DeepCopyOp from theano.compile import DeepCopyOp
from theano.gpuarray.basic_ops import HostFromGpu, GpuFromHost, GpuContiguous from theano.gpuarray.basic_ops import GpuContiguous, GpuFromHost, HostFromGpu
from theano.gpuarray.elemwise import GpuDimShuffle from theano.gpuarray.elemwise import GpuDimShuffle
from theano.gpuarray.subtensor import ( from theano.gpuarray.subtensor import (
GpuIncSubtensor,
GpuSubtensor,
GpuAdvancedSubtensor1,
GpuAdvancedSubtensor,
GpuAdvancedIncSubtensor, GpuAdvancedIncSubtensor,
GpuAdvancedIncSubtensor1, GpuAdvancedIncSubtensor1,
GpuAdvancedIncSubtensor1_dev20, GpuAdvancedIncSubtensor1_dev20,
GpuExtractDiag, GpuAdvancedSubtensor,
GpuAdvancedSubtensor1,
GpuAllocDiag, GpuAllocDiag,
GpuExtractDiag,
GpuIncSubtensor,
GpuSubtensor,
) )
from theano.gpuarray.type import gpuarray_shared_constructor from theano.gpuarray.type import gpuarray_shared_constructor
from tests import unittest_tools as utt
from tests.tensor.test_subtensor import TestSubtensor, TestAdvancedSubtensor
from tests.tensor.test_basic import TestAllocDiag
from tests.gpuarray.config import mode_with_gpu, test_ctx_name
class TestGPUSubtensor(TestSubtensor): class TestGPUSubtensor(TestSubtensor):
def setup_method(self): def setup_method(self):
......
import os import os
import pytest
import numpy as np import numpy as np
import pytest
import theano import theano
pygpu = pytest.importorskip("pygpu") pygpu = pytest.importorskip("pygpu")
from pickle import Unpickler from pickle import Unpickler
from tests.gpuarray.config import test_ctx_name
from tests.gpuarray.test_basic_ops import rand_gpuarray
from theano import config from theano import config
from theano.compile import DeepCopyOp, Rebroadcast, ViewOp from theano.compile import DeepCopyOp, Rebroadcast, ViewOp
from theano.gpuarray.type import GpuArrayType, gpuarray_shared_constructor from theano.gpuarray.type import GpuArrayType, gpuarray_shared_constructor
from tests.gpuarray.config import test_ctx_name
from tests.gpuarray.test_basic_ops import rand_gpuarray
# Disabled for now # Disabled for now
# from tests.tensor.test_sharedvar import makeSharedTester # from tests.tensor.test_sharedvar import makeSharedTester
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论