提交 cfd94c87 authored 作者: Frederic Bastien's avatar Frederic Bastien

added test for crah fix in commit 7879429f6a by Dumi. Fix another crash that new tests discovered.

上级 2dbb7baa
...@@ -183,7 +183,7 @@ def local_gpu_dot_to_dot22(node): ...@@ -183,7 +183,7 @@ def local_gpu_dot_to_dot22(node):
# case one: vector X matrix # case one: vector X matrix
if _is_real_vector(x) and _is_real_matrix(y): if _is_real_vector(x) and _is_real_matrix(y):
new_op = GpuDimShuffle((False,), ['x',0]) new_op = GpuDimShuffle((False,), ['x',0])
shape_out = y.shape[0].dimshuffle(['x']) shape_out = y.shape[1].dimshuffle(['x'])
gpu_x = new_op(gpu_from_host(x)) gpu_x = new_op(gpu_from_host(x))
gpu_y = gpu_from_host(y) gpu_y = gpu_from_host(y)
# case two: matrix X vector # case two: matrix X vector
...@@ -201,7 +201,7 @@ def local_gpu_dot_to_dot22(node): ...@@ -201,7 +201,7 @@ def local_gpu_dot_to_dot22(node):
x, y = node.inputs x, y = node.inputs
if _is_real_vector(x) and _is_real_matrix(y): if _is_real_vector(x) and _is_real_matrix(y):
new_op = GpuDimShuffle((False,), ['x',0]) new_op = GpuDimShuffle((False,), ['x',0])
shape_out = y.shape[0].dimshuffle(['x']) shape_out = y.shape[1].dimshuffle(['x'])
gpu_x = new_op(gpu_from_host(x)) gpu_x = new_op(gpu_from_host(x))
gpu_y = gpu_from_host(y) gpu_y = gpu_from_host(y)
......
...@@ -26,7 +26,7 @@ else: ...@@ -26,7 +26,7 @@ else:
def test_dot_vm(): def test_dot_vm():
''' Test vector dot matrix ''' ''' Test vector dot matrix '''
v = theano.shared( numpy.array(numpy.random.rand(2), dtype='float32')) v = theano.shared( numpy.array(numpy.random.rand(2), dtype='float32'))
m = theano.shared( numpy.array(numpy.random.rand(2,2), m = theano.shared( numpy.array(numpy.random.rand(2,5),
dtype='float32')) dtype='float32'))
no_gpu_f = theano.function([], theano.dot(v,m), mode = mode_without_gpu) no_gpu_f = theano.function([], theano.dot(v,m), mode = mode_without_gpu)
gpu_f = theano.function([], theano.dot(v,m), mode = mode_with_gpu) gpu_f = theano.function([], theano.dot(v,m), mode = mode_with_gpu)
...@@ -46,7 +46,7 @@ def test_dot_vm(): ...@@ -46,7 +46,7 @@ def test_dot_vm():
def test_dot_mv(): def test_dot_mv():
''' Test matrix dot vector ''' ''' Test matrix dot vector '''
v = theano.shared( numpy.array(numpy.random.rand(2), dtype='float32')) v = theano.shared( numpy.array(numpy.random.rand(2), dtype='float32'))
m = theano.shared( numpy.array(numpy.random.rand(2,2), m = theano.shared( numpy.array(numpy.random.rand(5,2),
dtype='float32')) dtype='float32'))
no_gpu_f = theano.function([], theano.dot(m,v), mode = mode_without_gpu) no_gpu_f = theano.function([], theano.dot(m,v), mode = mode_without_gpu)
gpu_f = theano.function([], theano.dot(m,v), mode = mode_with_gpu) gpu_f = theano.function([], theano.dot(m,v), mode = mode_with_gpu)
...@@ -66,8 +66,8 @@ def test_dot_mv(): ...@@ -66,8 +66,8 @@ def test_dot_mv():
def test_gemv1(): def test_gemv1():
''' test vector1+dot(matrix,vector2) ''' ''' test vector1+dot(matrix,vector2) '''
v1 = theano.shared( numpy.array(numpy.random.rand(2) , dtype='float32')) v1 = theano.shared( numpy.array(numpy.random.rand(2) , dtype='float32'))
v2 = theano.shared( numpy.array(numpy.random.rand(2) , dtype='float32')) v2 = theano.shared( numpy.array(numpy.random.rand(5) , dtype='float32'))
m = theano.shared( numpy.array(numpy.random.rand(2,2), dtype='float32')) m = theano.shared( numpy.array(numpy.random.rand(5,2), dtype='float32'))
no_gpu_f = theano.function([], v2+theano.dot(m,v1), mode = mode_without_gpu) no_gpu_f = theano.function([], v2+theano.dot(m,v1), mode = mode_without_gpu)
gpu_f = theano.function([], v2+theano.dot(m,v1), mode = mode_with_gpu) gpu_f = theano.function([], v2+theano.dot(m,v1), mode = mode_with_gpu)
...@@ -87,9 +87,9 @@ def test_gemv1(): ...@@ -87,9 +87,9 @@ def test_gemv1():
def test_gemv2(): def test_gemv2():
''' test vector1+dot(vector2,matrix) ''' ''' test vector1+dot(vector2,matrix) '''
v1 = theano.shared( numpy.array(numpy.random.rand(2) , dtype='float32')) v1 = theano.shared( numpy.array(numpy.random.rand(5) , dtype='float32'))
v2 = theano.shared( numpy.array(numpy.random.rand(2) , dtype='float32')) v2 = theano.shared( numpy.array(numpy.random.rand(2) , dtype='float32'))
m = theano.shared( numpy.array(numpy.random.rand(2,2), dtype='float32')) m = theano.shared( numpy.array(numpy.random.rand(5,2), dtype='float32'))
no_gpu_f = theano.function([], v2+theano.dot(v1,m), mode = mode_without_gpu) no_gpu_f = theano.function([], v2+theano.dot(v1,m), mode = mode_without_gpu)
gpu_f = theano.function([], v2+theano.dot(v1,m), mode = mode_with_gpu) gpu_f = theano.function([], v2+theano.dot(v1,m), mode = mode_with_gpu)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论