提交 50b4b531 authored 作者: nouiz's avatar nouiz

Merge pull request #470 from lamblin/fix_blas_tests

Fix to 2 blas tests in DebugMode
...@@ -306,7 +306,7 @@ class GpuGemv(GpuOp): ...@@ -306,7 +306,7 @@ class GpuGemv(GpuOp):
return Apply(self, [z, a, x, y, b], [z.type()]) return Apply(self, [z, a, x, y, b], [z.type()])
def c_code_cache_version(self): def c_code_cache_version(self):
return (2,) return (3,)
def c_code(self, node, name, inputs, outputs, sub): def c_code(self, node, name, inputs, outputs, sub):
#z_out = alpha * dot(x,y) + beta * z_in #z_out = alpha * dot(x,y) + beta * z_in
...@@ -333,6 +333,7 @@ class GpuGemv(GpuOp): ...@@ -333,6 +333,7 @@ class GpuGemv(GpuOp):
Py_INCREF(%(z_out)s); Py_INCREF(%(z_out)s);
} }
else if (%(z_out)s else if (%(z_out)s
&& (CudaNdarray_HOST_DIMS(%(z_out)s)[0] == CudaNdarray_HOST_DIMS(%(z_in)s)[0])
&& ((CudaNdarray_HOST_STRIDES(%(z_out)s)[0] > 0) && ((CudaNdarray_HOST_STRIDES(%(z_out)s)[0] > 0)
|| ((CudaNdarray_HOST_STRIDES(%(z_out)s)[0] == 0) || ((CudaNdarray_HOST_STRIDES(%(z_out)s)[0] == 0)
&& (CudaNdarray_HOST_DIMS(%(z_out)s)[0] == 1)))) && (CudaNdarray_HOST_DIMS(%(z_out)s)[0] == 1))))
......
...@@ -45,10 +45,13 @@ class ScipyGer(Ger): ...@@ -45,10 +45,13 @@ class ScipyGer(Ger):
# in-place on a, even when I tell it to. # in-place on a, even when I tell it to.
A = cA[0] A = cA[0]
if A.size == 0: if A.size == 0:
# We don't have to do anything, A is empty. # We don't have to compute anything, A is empty.
# We need this special case because Numpy considers it # We need this special case because Numpy considers it
# C-contiguous, wich is confusing. # C-contiguous, wich is confusing.
pass if not self.destructive:
# Sometimes numpy thinks empty matrices can share memory,
# so here to stop DebugMode from complaining.
A = A.copy()
elif A.flags['C_CONTIGUOUS']: elif A.flags['C_CONTIGUOUS']:
A = local_ger(calpha[0], cy[0], cx[0], a=A.T, A = local_ger(calpha[0], cy[0], cx[0], a=A.T,
overwrite_a=int(self.destructive)).T overwrite_a=int(self.destructive)).T
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论