dnn应用的python代码_Python dnn.dnn_available方法代码示例

本文详细介绍了Python中theano.sandbox.cuda.dnn.dnn_available方法的使用,通过多个代码示例展示如何在不同场景下正确调用此方法,包括检查CUDA和dnn库的可用性,以及在不同操作中如卷积、池化等的运用。适用于需要理解和应用该方法的开发者参考。
摘要由CSDN通过智能技术生成

本文整理汇总了Python中theano.sandbox.cuda.dnn.dnn_available方法的典型用法代码示例。如果您正苦于以下问题:Python dnn.dnn_available方法的具体用法?Python dnn.dnn_available怎么用?Python dnn.dnn_available使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块theano.sandbox.cuda.dnn的用法示例。

在下文中一共展示了dnn.dnn_available方法的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_old_pool_interface

​点赞 6

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_old_pool_interface():

if not cuda.dnn.dnn_available():

raise SkipTest(cuda.dnn.dnn_available.msg)

testfile_dir = os.path.dirname(os.path.realpath(__file__))

fname = 'old_pool_interface.pkl'

with open(os.path.join(testfile_dir, fname), 'rb') as fp:

try:

pickle.load(fp)

except ImportError:

# Windows sometimes fail with nonsensical errors like:

# ImportError: No module named type

# ImportError: No module named copy_reg

# when "type" and "copy_reg" are builtin modules.

if sys.platform == 'win32':

exc_type, exc_value, exc_trace = sys.exc_info()

reraise(SkipTest, exc_value, exc_trace)

raise

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:19,

示例2: test_dnn_conv_merge_mouts

​点赞 6

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_dnn_conv_merge_mouts():

# make sure it doesn't attempt to output/alpha merge a convolution

# that has multiple clients.

if not cuda.dnn.dnn_available():

raise SkipTest(cuda.dnn.dnn_available.msg)

img = T.ftensor4()

kern = T.ftensor4()

out = T.ftensor4()

conv = dnn.dnn_conv(img, kern)

lr = numpy.asarray(0.05, dtype='float32')

if cuda.dnn.version() == -1:

# Can't merge alpha with cudnn v1

fr = conv + out

else:

fr = lr * (conv + out)

rr = conv * lr

f = theano.function([img, kern, out], [fr, rr], mode=mode_with_gpu)

convs = [n for n in f.maker.fgraph.toposort()

if isinstance(n.op, dnn.GpuDnnConv)]

assert len(convs) == 1

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:26,

示例3: test_dnn_conv_merge_broad

​点赞 6

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_dnn_conv_merge_broad():

# Make sure that we don't apply output_merge on broadcasted values.

if not cuda.dnn.dnn_available():

raise SkipTest(cuda.dnn.dnn_available.msg)

img = T.ftensor4()

kern = T.ftensor4()

conv = dnn.dnn_conv(img, kern)

lr = numpy.asarray(0.05, dtype='float32')

# this does broadcasting

fr = conv + lr

f = theano.function([img, kern], [fr])

convs = [n for n in f.maker.fgraph.toposort()

if isinstance(n.op, dnn.GpuDnnConv)]

assert len(convs) == 1

conv = convs[0]

# Assert output was not merged

assert isinstance(conv.inputs[2].owner.op, GpuAllocEmpty)

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:23,

示例4: get_output_for

​点赞 6

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def get_output_for(self, input, *args, **kwargs):

if not dnn_available:

raise RuntimeError("cudnn is not available.")

# by default we assume 'cross', consistent with earlier versions of conv2d.

conv_mode = 'conv' if self.flip_filters else 'cross'

# if 'border_mode' is one of 'valid' or 'full' use that.

# else use pad directly.

border_mode = self.border_mode if (self.border_mode is not None) else self.pad

conved = dnn.dnn_conv(img=input,

kerns=self.W,

subsample=self.strides,

border_mode=border_mode,

conv_mode=conv_mode

)

if self.b is None:

activation = conved

elif self.untie_biases:

activation = conved + self.b.dimshuffle('x', 0, 1, 2)

else:

activation = conved + self.b.dimshuffle('x', 0, 'x', 'x')

return self.nonlinearity(activation)

开发者ID:benanne,项目名称:kaggle-ndsb,代码行数:25,

示例5: setUp

​点赞 6

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def setUp(self):

"""

Set up a test image and filter to re-use.

"""

skip_if_no_gpu()

if not dnn_available():

raise SkipTest('Skipping tests cause cudnn is not available')

self.orig_floatX = theano.config.floatX

theano.config.floatX = 'float32'

self.image = np.random.rand(1, 1, 3, 3).astype(theano.config.floatX)

self.image_tensor = tensor.tensor4()

self.input_space = Conv2DSpace((3, 3), 1, axes=('b', 'c', 0, 1))

self.filters_values = np.ones(

(1, 1, 2, 2), dtype=theano.config.floatX

)

self.filters = sharedX(self.filters_values, name='filters')

self.batch_size = 1

self.cudnn2d = Cudnn2D(self.filters, self.batch_size, self.input_space)

开发者ID:zchengquan,项目名称:TextDetector,代码行数:21,

示例6: get_output

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def get_output(self, train=False):

X = self.get_input(train)

newshape = (X.shape[0]*X.shape[1], X.shape[2], X.shape[3], X.shape[4])

Y = theano.tensor.reshape(X, newshape) #collapse num_samples and num_timesteps

border_mode = self.border_mode

if on_gpu() and dnn.dnn_available():

if border_mode == 'same':

assert(self.subsample == (1, 1))

pad_x = (self.nb_row - self.subsample[0]) // 2

pad_y = (self.nb_col - self.subsample[1]) // 2

conv_out = dnn.dnn_conv(img=Y,

kerns=self.W,

border_mode=(pad_x, pad_y))

else:

conv_out = dnn.dnn_conv(img=Y,

kerns=self.W,

border_mode=border_mode,

subsample=self.subsample)

else:

if border_mode == 'same':

border_mode = 'full'

conv_out = theano.tensor.nnet.conv.conv2d(Y, self.W,

border_mode=border_mode, subsample=self.subsample)

if self.border_mode == 'same':

shift_x = (self.nb_row - 1) // 2

shift_y = (self.nb_col - 1) // 2

conv_out = conv_out[:, :, shift_x:Y.shape[2] + shift_x, shift_y:Y.shape[3] + shift_y]

output = self.activation(conv_out + self.b.dimshuffle('x', 0, 'x', 'x'))

newshape = (X.shape[0], X.shape[1], output.shape[1], output.shape[2], output.shape[3])

return theano.tensor.reshape(output, newshape)

开发者ID:textclf,项目名称:fancy-cnn,代码行数:35,

示例7: test_dnn_conv_desc_merge

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_dnn_conv_desc_merge():

if not cuda.dnn.dnn_available():

raise SkipTest(cuda.dnn.dnn_available.msg)

img_shp = T.as_tensor_variable(

numpy.asarray([2, 1, 8, 8]).astype('int64'))

kern_shp = T.as_tensor_variable(

numpy.asarray([3, 1, 2, 2]).astype('int64'))

desc1 = dnn.GpuDnnConvDesc(border_mode='valid', subsample=(2, 2),

conv_mode='conv')(img_shp, kern_shp)

desc2 = dnn.GpuDnnConvDesc(border_mode='full', subsample=(1, 1),

conv_mode='cross')(img_shp, kern_shp)

# CDataType is not DeepCopyable so this will crash if we don't use

# borrow=True

f = theano.function([], [theano.Out(desc1, borrow=True),

theano.Out(desc2, borrow=True)],

mode=mode_with_gpu)

d1, d2 = f()

# This will be the case if they are merged, which would be bad.

assert d1 != d2

desc1v2 = dnn.GpuDnnConvDesc(border_mode='valid', subsample=(2, 2),

conv_mode='conv')(img_shp, kern_shp)

f = theano.function([], [theano.Out(desc1, borrow=True),

theano.Out(desc1v2, borrow=True)],

mode=mode_with_gpu)

assert len([n for n in f.maker.fgraph.apply_nodes

if isinstance(n.op, dnn.GpuDnnConvDesc)]) == 1

# CDATA type don't equal even if they represent the same object

# So we can't use debugmode with it.

if theano.config.mode not in ["DebugMode", "DEBUG_MODE"]:

d1, d2 = f()

# They won't be equal if they aren't merged.

assert d1 == d2

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:39,

示例8: test_dnn_conv_merge

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_dnn_conv_merge():

"""This test that we merge correctly multiple dnn_conv.

This can is more difficult due to GpuEmptyAlloc that aren't

merged.

"""

if not cuda.dnn.dnn_available():

raise SkipTest(cuda.dnn.dnn_available.msg)

img_shp = [2, 5, 6, 8]

kern_shp = [3, 5, 5, 6]

img = T.ftensor4('img')

kern = T.ftensor4('kern')

out = T.ftensor4('out')

desc = dnn.GpuDnnConvDesc(

border_mode='valid')(img.shape, kern.shape)

# Test forward op

o1 = dnn.dnn_conv(img, kern)

o2 = dnn.dnn_conv(img, kern)

f = theano.function([img, kern], [o1, o2], mode=mode_with_gpu)

d1, d2 = f(numpy.random.rand(*img_shp).astype('float32'),

numpy.random.rand(*kern_shp).astype('float32'))

topo = f.maker.fgraph.toposort()

assert len([n for n in topo if isinstance(n.op, dnn.GpuDnnConv)]) == 1

# Test grad w op

o1 = dnn.GpuDnnConvGradW()(img, kern, out, desc)

o2 = dnn.GpuDnnConvGradW()(img, kern, out, desc)

f = theano.function([img, kern, out], [o1, o2], mode=mode_with_gpu)

topo = f.maker.fgraph.toposort()

assert len([n for n in topo if isinstance(n.op, dnn.GpuDnnConvGradW)]) == 1

# Test grad i op

o1 = dnn.GpuDnnConvGradI()(img, kern, out, desc)

o2 = dnn.GpuDnnConvGradI()(img, kern, out, desc)

f = theano.function([img, kern, out], [o1, o2], mode=mode_with_gpu)

topo = f.maker.fgraph.toposort()

assert len([n for n in topo if isinstance(n.op, dnn.GpuDnnConvGradI)]) == 1

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:41,

示例9: setUp

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def setUp(self):

if not cuda.dnn.dnn_available():

raise SkipTest(cuda.dnn.dnn_available.msg)

utt.seed_rng()

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:6,

示例10: test_dnn_tag

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_dnn_tag():

"""

Test that if cudnn isn't avail we crash and that if it is avail, we use it.

"""

x = T.ftensor4()

old = theano.config.on_opt_error

theano.config.on_opt_error = "raise"

sio = StringIO()

handler = logging.StreamHandler(sio)

logging.getLogger('theano.compile.tests.test_dnn').addHandler(handler)

# Silence original handler when intentionnally generating warning messages

logging.getLogger('theano').removeHandler(theano.logging_default_handler)

raised = False

try:

f = theano.function(

[x],

pool_2d(x, ds=(2, 2), ignore_border=True),

mode=mode_with_gpu.including("cudnn"))

except (AssertionError, RuntimeError):

assert not cuda.dnn.dnn_available()

raised = True

finally:

theano.config.on_opt_error = old

logging.getLogger(

'theano.compile.tests.test_dnn').removeHandler(handler)

logging.getLogger('theano').addHandler(theano.logging_default_handler)

if not raised:

assert cuda.dnn.dnn_available()

assert any([isinstance(n.op, cuda.dnn.GpuDnnPool)

for n in f.maker.fgraph.toposort()])

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:34,

示例11: test_softmax

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_softmax(self):

if not dnn.dnn_available():

raise SkipTest(dnn.dnn_available.msg)

t = T.ftensor4('t')

rand_tensor = numpy.asarray(

numpy.random.rand(5, 4, 3, 2),

dtype='float32'

)

self._compile_and_check(

[t],

[dnn.GpuDnnSoftmax('bc01', 'accurate', 'channel')(t)],

[rand_tensor],

dnn.GpuDnnSoftmax

)

self._compile_and_check(

[t],

[

T.grad(

dnn.GpuDnnSoftmax(

'bc01',

'accurate',

'channel'

)(t).mean(),

t

)

],

[rand_tensor],

dnn.GpuDnnSoftmaxGrad

)

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:32,

示例12: test_conv

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_conv(self):

if not dnn.dnn_available():

raise SkipTest(dnn.dnn_available.msg)

img = T.ftensor4('img')

kerns = T.ftensor4('kerns')

out = T.ftensor4('out')

img_val = numpy.asarray(

numpy.random.rand(10, 2, 6, 4),

dtype='float32'

)

kern_vals = numpy.asarray(

numpy.random.rand(8, 2, 4, 3),

dtype='float32'

)

for params in product(

['valid', 'full', 'half'],

[(1, 1), (2, 2)],

['conv', 'cross']

):

out_vals = numpy.zeros(

dnn.GpuDnnConv.get_out_shape(img_val.shape, kern_vals.shape,

border_mode=params[0],

subsample=params[1]),

dtype='float32')

desc = dnn.GpuDnnConvDesc(

border_mode=params[0],

subsample=params[1],

conv_mode=params[2]

)(img.shape, kerns.shape)

conv = dnn.GpuDnnConv()(img, kerns, out, desc)

self._compile_and_check(

[img, kerns, out],

[conv],

[img_val, kern_vals, out_vals],

dnn.GpuDnnConv

)

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:39,

示例13: test_conv3d

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_conv3d(self):

if not (cuda.dnn.dnn_available() and dnn.version() >= (2000, 2000)):

raise SkipTest('"CuDNN 3D convolution requires CuDNN v2')

ftensor5 = T.TensorType(dtype="float32", broadcastable=(False,) * 5)

img = ftensor5('img')

kerns = ftensor5('kerns')

out = ftensor5('out')

img_val = numpy.asarray(

numpy.random.rand(10, 2, 6, 4, 11),

dtype='float32'

)

kern_vals = numpy.asarray(

numpy.random.rand(8, 2, 4, 3, 1),

dtype='float32'

)

for params in product(

['valid', 'full', 'half'],

[(1, 1, 1), (2, 2, 2)],

['conv', 'cross']

):

out_vals = numpy.zeros(

dnn.GpuDnnConv3d.get_out_shape(img_val.shape, kern_vals.shape,

border_mode=params[0],

subsample=params[1]),

dtype='float32')

desc = dnn.GpuDnnConvDesc(

border_mode=params[0],

subsample=params[1],

conv_mode=params[2]

)(img.shape, kerns.shape)

conv = dnn.GpuDnnConv3d()(img, kerns, out, desc)

self._compile_and_check(

[img, kerns, out],

[conv],

[img_val, kern_vals, out_vals],

dnn.GpuDnnConv3d

)

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:40,

示例14: test_pool

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_pool(self):

if not dnn.dnn_available():

raise SkipTest(dnn.dnn_available.msg)

img = T.ftensor4('img')

img_val = numpy.asarray(

numpy.random.rand(2, 3, 4, 5),

dtype='float32'

)

# 'average_exc_pad' is disabled for versions < 4004

if cuda.dnn.version() < (4004, 4004):

modes = ['max', 'average_inc_pad']

else:

modes = ['max', 'average_inc_pad', 'average_exc_pad']

for params in product(

[(1, 1), (2, 2), (3, 3)],

[(1, 1), (2, 2), (3, 3)],

modes

):

self._compile_and_check(

[img],

[dnn.GpuDnnPool(mode=params[2])

(img, params[0], params[1], (0, 0))],

[img_val],

dnn.GpuDnnPool

)

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:29,

示例15: test_pool_grad

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_pool_grad(self):

if not dnn.dnn_available():

raise SkipTest(dnn.dnn_available.msg)

img = T.ftensor4('img')

img_grad = T.ftensor4('img_grad')

out = T.ftensor4('out')

img_val = numpy.asarray(

numpy.random.rand(2, 3, 4, 5),

dtype='float32'

)

img_grad_val = numpy.asarray(

numpy.random.rand(2, 3, 4, 5),

dtype='float32'

)

out_val = numpy.asarray(

numpy.random.rand(2, 3, 4, 5),

dtype='float32'

)

for params in product(

[(1, 1), (2, 2), (3, 3)],

[(1, 1), (2, 2), (3, 3)],

['max', 'average_inc_pad']

):

pool_grad = dnn.GpuDnnPoolGrad()(

img,

out,

img_grad,

params[0],

params[1],

(0, 0)

)

self._compile_and_check(

[img, img_grad, out],

[pool_grad],

[img_val, img_grad_val, out_val],

dnn.GpuDnnPoolGrad

)

# this has been a problem in the past

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:43,

示例16: test_dnn_conv_grad

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_dnn_conv_grad():

if not cuda.dnn.dnn_available() or dnn.version() == -1:

raise SkipTest('alpha != 1.0 not supported in cudnn v1')

b = 1

c = 4

f = 3

ih = 2

iw = 8

kh = 2

kw = 2

img_val = numpy.random.random((b, c, ih, iw)).astype('float32')

kern_val = numpy.random.random((f, c, kh, kw)).astype('float32')

out_val = numpy.random.random((b, f, ih - kw + 1,

iw - kw + 1)).astype('float32')

def dconv(img, kern, out):

desc = dnn.GpuDnnConvDesc(border_mode='valid', subsample=(1, 1),

conv_mode='conv')(img.shape, kern.shape)

return dnn.GpuDnnConv()(img, kern, out, desc, alpha=0.5, beta=0.75)

def dconvi(img, kern, out):

desc = dnn.GpuDnnConvDesc(border_mode='valid', subsample=(1, 1),

conv_mode='conv')(img.shape, kern.shape)

return dnn.GpuDnnConvGradI()(kern, out, img, desc, alpha=-1.0,

beta=0.0)

def dconvw(img, kern, out):

desc = dnn.GpuDnnConvDesc(border_mode='valid', subsample=(1, 1),

conv_mode='conv')(img.shape, kern.shape)

return dnn.GpuDnnConvGradW()(img, out, kern, desc, alpha=0.75,

beta=-1.0)

utt.verify_grad(dconv, [img_val, kern_val, out_val], mode=mode_with_gpu)

utt.verify_grad(dconvi, [img_val, kern_val, out_val], mode=mode_with_gpu)

utt.verify_grad(dconvw, [img_val, kern_val, out_val], mode=mode_with_gpu)

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:38,

示例17: get_conv3d_test_cases

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def get_conv3d_test_cases():

# Every element of test_shapes follows the format

# [input_shape, filter_shape, subsample]

test_shapes = [[(128, 3, 5, 5, 5), (64, 3, 1, 2, 4), (1, 1, 1)],

[(8, 4, 20, 12, 15), (5, 4, 6, 12, 4), (2, 2, 2)],

[(8, 1, 20, 12, 15), (5, 1, 6, 12, 4), (3, 3, 3)],

[(8, 1, 20, 12, 15), (5, 1, 6, 12, 4), (3, 2, 1)],

[(8, 1, 20, 12, 15), (5, 1, 6, 12, 4), (3, 2, 1)],

# Test with 1x1x1 filters

[(8, 1, 10, 10, 10), (10, 1, 1, 1, 1), (1, 1, 1)],

# Test with dimensions larger than 1024 (thread block dim)

[(1025, 1, 2, 3, 4), (5, 1, 1, 2, 3), (1, 1, 1)],

[(8, 1, 2, 3, 4), (1025, 1, 1, 2, 3), (1, 1, 1)],

[(8, 1025, 2, 3, 4), (5, 1025, 1, 1, 2), (1, 1, 1)],

[(8, 1, 1030, 3, 4), (5, 1, 1025, 1, 1), (1, 1, 1)],

[(8, 1, 2, 1030, 4), (5, 1, 2, 1025, 1), (1, 1, 1)],

[(8, 1, 2, 3, 1030), (5, 1, 1, 2, 1025), (1, 1, 1)],

# The equivalent of this caused a crash with conv2d

[(1, 1, 1, 44800, 1), (6, 1, 1, 1, 1), (1, 1, 1)]]

# With border mode 'full', test with kernel bigger than image in some/all

# dimensions

test_shapes_full = [[(6, 2, 2, 2, 2), (4, 2, 3, 1, 1), (1, 1, 1)],

[(6, 2, 2, 2, 2), (4, 2, 1, 3, 1), (1, 1, 1)],

[(6, 2, 2, 2, 2), (4, 2, 1, 1, 3), (1, 1, 1)],

[(6, 2, 2, 2, 2), (4, 2, 5, 5, 5), (1, 1, 1)]]

border_modes = ['valid', 'full', 'half', (1, 2, 3), (3, 2, 1), 1, 2]

conv_modes = ['conv', 'cross']

if cuda.dnn.dnn_available() and dnn.version() >= (3000, 3000):

itt = chain(product(test_shapes, border_modes, conv_modes),

product(test_shapes_full, ['full'], conv_modes))

else:

# CuDNN, before V3, did not support kernels larger than the inputs,

# even if the original inputs were padded so they would be larger than

# the kernels. If using a version older than V3 don't run the tests

# with kernels larger than the unpadded inputs.

itt = product(test_shapes, border_modes, conv_modes)

return itt

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:42,

示例18: test_version

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_version():

if not cuda.dnn.dnn_available():

raise SkipTest(cuda.dnn.dnn_available.msg)

assert isinstance(cuda.dnn.version(), (int, tuple))

开发者ID:muhanzhang,项目名称:D-VAE,代码行数:6,

示例19: test_old_pool_interface

​点赞 5

# 需要导入模块: from theano.sandbox.cuda import dnn [as 别名]

# 或者: from theano.sandbox.cuda.dnn import dnn_available [as 别名]

def test_old_pool_interface():

if not cuda.dnn.dnn_available():

raise SkipTest(cuda.dnn.dnn_available.msg)

testfile_dir = os.path.dirname(os.path.realpath(__file__))

fname = 'old_pool_interface.pkl'

with open(os.path.join(testfile_dir, fname), 'rb') as fp:

pickle.load(fp)

开发者ID:rizar,项目名称:attention-lvcsr,代码行数:9,

注:本文中的theano.sandbox.cuda.dnn.dnn_available方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值