From 0f74a746148b94ea27599904f6f3ba713faa51d9 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 6 Feb 2023 15:37:13 +0100 Subject: [PATCH 1/2] Correct deletion when reassigning a dsarray --- dislib/data/array.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dislib/data/array.py b/dislib/data/array.py index dc481d92..e57afd77 100644 --- a/dislib/data/array.py +++ b/dislib/data/array.py @@ -73,8 +73,10 @@ def __init__(self, blocks, top_left_shape, reg_shape, shape, sparse, def __del__(self): if self._delete: - [compss_delete_object(b) for r_block in self._blocks for b in - r_block] + for r_block in self._blocks: + for b in r_block: + if sys.getrefcount(b) <= 3: + compss_delete_object(b) def __str__(self): return "ds-array(blocks=(...), top_left_shape=%r, reg_shape=%r, " \ From cd3a8ed677ed1472ddfc6be89867280516dadc5f Mon Sep 17 00:00:00 2001 From: root Date: Mon, 6 Feb 2023 15:45:17 +0100 Subject: [PATCH 2/2] Correct deletion when reassigning a dsarray --- dislib/classification/knn/base.py | 2 +- dislib/data/array.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dislib/classification/knn/base.py b/dislib/classification/knn/base.py index 2a16e2f7..5935d47d 100644 --- a/dislib/classification/knn/base.py +++ b/dislib/classification/knn/base.py @@ -53,7 +53,7 @@ class KNeighborsClassifier(BaseEstimator): but different labels, the results will depend on the ordering of the training data. https://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm - + Examples -------- >>> import dislib as ds diff --git a/dislib/data/array.py b/dislib/data/array.py index e57afd77..c29337ea 100644 --- a/dislib/data/array.py +++ b/dislib/data/array.py @@ -12,6 +12,7 @@ from scipy.sparse import issparse, csr_matrix from sklearn.utils import check_random_state import math +import sys class Array(object):