Use coo_matrix.eliminate_zeros in csr_matrix.eliminate_zeros when cuda is old
@@ -137,7 +137,13 @@ class csr_matrix(compressed._compressed_sparse_matrix):
def eliminate_zeros(self):
"""Removes zero entories in place."""
+ self.sum_duplicates()
+ if cupy.cuda.runtime.runtimeGetVersion() >= 8000:
compress = cusparse.csr2csr_compress(self, 0)
+ else:
+ coo = self.tocoo()
+ coo.eliminate_zeros()
+ compress = coo.tocsr()
self.data = compress.data
self.indices = compress.indices
self.indptr = compress.indptr
