提交 ca55d2f9 authored 作者: nouiz's avatar nouiz

Merge pull request #908 from lamblin/fix_test_neib

Fix tests for image2neibs
...@@ -404,6 +404,7 @@ def gpu_images2neibs(ten4, neib_shape, neib_step=None, mode='valid'): ...@@ -404,6 +404,7 @@ def gpu_images2neibs(ten4, neib_shape, neib_step=None, mode='valid'):
@local_optimizer() @local_optimizer()
def use_gpu_images2neibs(node): def use_gpu_images2neibs(node):
if (type(node.op) is Images2Neibs and if (type(node.op) is Images2Neibs and
node.inputs[0].dtype == 'float32' and
node.op.mode in ['valid', 'wrap_centered']): node.op.mode in ['valid', 'wrap_centered']):
return [host_from_gpu(gpu_images2neibs(gpu_from_host(node.inputs[0]), return [host_from_gpu(gpu_images2neibs(gpu_from_host(node.inputs[0]),
node.inputs[1], node.inputs[2], node.inputs[1], node.inputs[2],
......
...@@ -139,6 +139,7 @@ class NVCC_compiler(object): ...@@ -139,6 +139,7 @@ class NVCC_compiler(object):
default_to_move_computation_to_gpu=False, default_to_move_computation_to_gpu=False,
move_shared_float32_to_gpu=False, move_shared_float32_to_gpu=False,
enable_cuda=False) enable_cuda=False)
n = theano.sandbox.cuda.use.device_number
p = theano.sandbox.cuda.device_properties(n) p = theano.sandbox.cuda.device_properties(n)
flags.append('-arch=sm_' + str(p['major']) + str(p['minor'])) flags.append('-arch=sm_' + str(p['major']) + str(p['minor']))
......
...@@ -20,6 +20,7 @@ else: ...@@ -20,6 +20,7 @@ else:
class T_GpuImages2Neibs(theano.sandbox.test_neighbours.T_Images2Neibs): class T_GpuImages2Neibs(theano.sandbox.test_neighbours.T_Images2Neibs):
mode = mode_with_gpu mode = mode_with_gpu
op = GpuImages2Neibs op = GpuImages2Neibs
dtypes = ['float32']
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
...@@ -166,9 +166,11 @@ class T_OpContractMixin(object): ...@@ -166,9 +166,11 @@ class T_OpContractMixin(object):
class InferShapeTester(unittest.TestCase): class InferShapeTester(unittest.TestCase):
def setUp(self): def setUp(self):
seed_rng() seed_rng()
# Take into account any mode that may be defined in a child class
mode = getattr(self, 'mode', theano.compile.get_default_mode())
# This mode seems to be the minimal one including the shape_i # This mode seems to be the minimal one including the shape_i
# optimizations, if we don't want to enumerate them explicitly. # optimizations, if we don't want to enumerate them explicitly.
self.mode = theano.compile.get_default_mode().including("canonicalize") self.mode = mode.including("canonicalize")
def _compile_and_check(self, inputs, outputs, numeric_inputs, cls, def _compile_and_check(self, inputs, outputs, numeric_inputs, cls,
excluding=None): excluding=None):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论