提交 3c015784 authored 作者: Frederic Bastien's avatar Frederic Bastien

Make code more readable

上级 783d83e7
...@@ -20,8 +20,7 @@ if theano.config.mode == 'FAST_COMPILE': ...@@ -20,8 +20,7 @@ if theano.config.mode == 'FAST_COMPILE':
mode_without_gpu = theano.compile.mode.get_mode('FAST_RUN') mode_without_gpu = theano.compile.mode.get_mode('FAST_RUN')
else: else:
mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu') mode_with_gpu = theano.compile.mode.get_default_mode().including('gpu')
mode_without_gpu = theano.compile.mode.get_default_mode() mode_without_gpu = theano.compile.mode.get_default_mode().excluding('gpu')
mode_without_gpu = mode_without_gpu.excluding('gpu')
def test_GpuCrossentropySoftmaxArgmax1HotWithBias(): def test_GpuCrossentropySoftmaxArgmax1HotWithBias():
......
...@@ -171,7 +171,7 @@ def test_pooling(): ...@@ -171,7 +171,7 @@ def test_pooling():
raise SkipTest(dnn.dnn_available.msg) raise SkipTest(dnn.dnn_available.msg)
# 'average_exc_pad' is disabled for versions < 4004 # 'average_exc_pad' is disabled for versions < 4004
if dnn.version(False) < 4004: if dnn.version(raises=False) < 4004:
modes = ('max', 'average_inc_pad') modes = ('max', 'average_inc_pad')
else: else:
modes = ('max', 'average_inc_pad', 'average_exc_pad') modes = ('max', 'average_inc_pad', 'average_exc_pad')
...@@ -464,7 +464,7 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -464,7 +464,7 @@ class TestDnnInferShapes(utt.InferShapeTester):
[conv_modes[0]])), [conv_modes[0]])),
testcase_func_name=utt.custom_name_func) testcase_func_name=utt.custom_name_func)
def test_conv(self, algo, border_mode, conv_mode): def test_conv(self, algo, border_mode, conv_mode):
if algo == 'winograd' and dnn.version(False) < 5000: if algo == 'winograd' and dnn.version(raises=False) < 5000:
raise SkipTest(dnn.dnn_available.msg) raise SkipTest(dnn.dnn_available.msg)
self._test_conv(T.ftensor4('img'), self._test_conv(T.ftensor4('img'),
...@@ -597,7 +597,7 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -597,7 +597,7 @@ class TestDnnInferShapes(utt.InferShapeTester):
) )
# 'average_exc_pad' is disabled for versions < 4004 # 'average_exc_pad' is disabled for versions < 4004
if dnn.version(False) < 4004: if dnn.version(raises=False) < 4004:
modes = ['max', 'average_inc_pad'] modes = ['max', 'average_inc_pad']
else: else:
modes = ['max', 'average_inc_pad', 'average_exc_pad'] modes = ['max', 'average_inc_pad', 'average_exc_pad']
...@@ -895,7 +895,7 @@ class test_SoftMax(test_nnet.test_SoftMax): ...@@ -895,7 +895,7 @@ class test_SoftMax(test_nnet.test_SoftMax):
def test_log_softmax(self): def test_log_softmax(self):
# This is a test for an optimization that depends on cuDNN v3 or # This is a test for an optimization that depends on cuDNN v3 or
# more recent. Don't test if the cuDNN version is too old. # more recent. Don't test if the cuDNN version is too old.
if dnn.version(False) < 3000: if dnn.version(raises=False) < 3000:
raise SkipTest("Log-softmax is only in cudnn v3+") raise SkipTest("Log-softmax is only in cudnn v3+")
x = T.ftensor4() x = T.ftensor4()
...@@ -936,7 +936,7 @@ class test_SoftMax(test_nnet.test_SoftMax): ...@@ -936,7 +936,7 @@ class test_SoftMax(test_nnet.test_SoftMax):
# This is a test for an optimization that depends on cuDNN v3 or # This is a test for an optimization that depends on cuDNN v3 or
# more recent. Don't test if the cuDNN version is too old. # more recent. Don't test if the cuDNN version is too old.
if dnn.version(False) < 3000: if dnn.version(raises=False) < 3000:
raise SkipTest("Log-softmax is only in cudnn v3+") raise SkipTest("Log-softmax is only in cudnn v3+")
# Compile a reference function, on the CPU, to be used to validate the # Compile a reference function, on the CPU, to be used to validate the
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论