<s> from __future__ import absolute_import , print_function , division <EOL> import numpy <EOL> import theano <EOL> from theano . tensor . nnet . tests import test_abstract_conv <EOL> from theano . sandbox . cuda import float32_shared_constructor as gpu_shared <EOL> from theano . sandbox . cuda . dnn import ( <EOL> dnn_available , <EOL> GpuDnnConv , GpuDnnConvGradW , GpuDnnConvGradI ) <EOL> from theano . sandbox . cuda . blas import ( <EOL> GpuCorrMM , GpuCorrMM_gradWeights , GpuCorrMM_gradInputs ) <EOL> from nose . plugins . skip import SkipTest <EOL> import theano . sandbox . cuda as cuda <EOL> if not cuda . cuda_available : <EOL> raise SkipTest ( '<STR_LIT>' ) <EOL> if theano . config . mode == '<STR_LIT>' : <EOL> mode_with_gpu = theano . compile . mode . get_mode ( '<STR_LIT>' ) . including ( '<STR_LIT>' ) <EOL> else : <EOL> mode_with_gpu = theano . compile . mode . get_default_mode ( ) . including ( '<STR_LIT>' ) <EOL> class TestDnnConv2d ( test_abstract_conv . BaseTestConv2d ) : <EOL> def setUp ( self ) : <EOL> super ( TestDnnConv2d , self ) . setUp ( ) <EOL> self . provide_shape = [ False ] <EOL> self . shared = gpu_shared <EOL> def tcase ( self , i , f , s , b , flip , provide_shape ) : <EOL> if not dnn_available ( ) : <EOL> raise SkipTest ( cuda . dnn . dnn_available . msg ) <EOL> mode = mode_with_gpu <EOL> o = self . get_output_shape ( i , f , s , b ) <EOL> self . run_fwd ( inputs_shape = i , filters_shape = f , subsample = s , <EOL> verify_grad = True , mode = mode , <EOL> provide_shape = provide_shape , border_mode = b , <EOL> filter_flip = flip , target_op = GpuDnnConv ) <EOL> self . run_gradweight ( inputs_shape = i , filters_shape = f , <EOL> output_shape = o , subsample = s , <EOL> verify_grad = True , mode = mode , <EOL> provide_shape = provide_shape , border_mode = b , <EOL> filter_flip = flip , target_op = GpuDnnConvGradW ) <EOL> self . run_gradinput ( inputs_shape = i , filters_shape = f , <EOL> output_shape = o , subsample = s , <EOL> verify_grad = True , mode = mode , <EOL> provide_shape = provide_shape , border_mode = b , <EOL> filter_flip = flip , target_op = GpuDnnConvGradI ) <EOL> class TestCorrMMConv2d ( test_abstract_conv . BaseTestConv2d ) : <EOL> def setUp ( self ) : <EOL> super ( TestCorrMMConv2d , self ) . setUp ( ) <EOL> self . shared = gpu_shared <EOL> self . mode = mode_with_gpu . excluding ( '<STR_LIT>' ) <EOL> def tcase ( self , i , f , s , b , flip , provide_shape ) : <EOL> mode = self . mode <EOL> o = self . get_output_shape ( i , f , s , b ) <EOL> self . run_fwd ( inputs_shape = i , filters_shape = f , subsample = s , <EOL> verify_grad = True , mode = mode , <EOL> provide_shape = provide_shape , border_mode = b , <EOL> filter_flip = flip , <EOL> target_op = ( GpuCorrMM , <EOL> GpuCorrMM_gradWeights , <EOL> GpuCorrMM_gradInputs ) ) <EOL> self . run_gradweight ( inputs_shape = i , filters_shape = f , <EOL> output_shape = o , subsample = s , <EOL> verify_grad = True , mode = mode , <EOL> provide_shape = provide_shape , border_mode = b , <EOL> filter_flip = flip , <EOL> target_op = GpuCorrMM_gradWeights ) <EOL> self . run_gradinput ( inputs_shape = i , filters_shape = f , <EOL> output_shape = o , subsample = s , <EOL> verify_grad = True , mode = mode , <EOL> provide_shape = provide_shape , border_mode = b , <EOL> filter_flip = flip , <EOL> target_op = GpuCorrMM_gradInputs ) <EOL> class TestDnnConvTypes ( test_abstract_conv . TestConvTypes ) : <EOL> def setUp ( self ) : <EOL> self . input = cuda . ftensor4 ( ) <EOL> self . filters = cuda . ftensor4 ( ) <EOL> self . topgrad = cuda . ftensor4 ( ) <EOL> self . constant_tensor = cuda . CudaNdarray ( <EOL> numpy . zeros ( ( <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:7> , <NUM_LIT:11> ) , dtype = '<STR_LIT>' ) ) </s>
