Commit dffd0db9 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

BUG: return different function if sparse multiplication is empty

parent 061c0d6e
Pipeline #5303 failed with stage
in 7 minutes and 44 seconds
......@@ -137,10 +137,15 @@ def sparse_mult_prepare(sparse):
"""Returns a function that does the GPU multiplication for the provided sparse matrix.
"""
gpu_sparse = _sparse_mult_to_gpu(sparse)
output = gpuarray.zeros((M, ), dtype='f4' if dtype == 'float' else 'f8')
if len(gpu_sparse[-1]) == 0:
def empty_sparse_mult(vec_in):
return output
return empty_sparse_mult
M = sparse.shape[0]
gpu_func = cached_func(_sparse_mult_mod_vector(gpu_sparse[0].size - 1), 'sparse_matrix_mult')
input = gpuarray.zeros((sparse.shape[1], ), dtype='f4' if dtype == 'float' else 'f8')
output = gpuarray.zeros((M, ), dtype='f4' if dtype == 'float' else 'f8')
stream = drv.Stream()
def sparse_mult(vec_in):
"""Does a sparse matrix multiplication.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment