Skip to content

Commit 6af1b3d

Browse files
authored
Fix minor issue on self.col and self.data
1 parent 5623da0 commit 6af1b3d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/thundersvm/thundersvm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ def load_from_file(self, path):
442442
sv_indices = (c_int * self.n_sv)()
443443
thundersvm.get_sv(csr_row, csr_col, csr_data, data_size, sv_indices, c_void_p(self.model))
444444
self.row = np.frombuffer(csr_row, dtype=np.int32)
445-
self.col = np.frombuffer(csr_col, dtype=np.int32)
446-
self.data = np.frombuffer(csr_data, dtype=np.float32)
445+
self.col = np.frombuffer(csr_col, dtype=np.int32)[:data_size[0]]
446+
self.data = np.frombuffer(csr_data, dtype=np.float32)[:data_size[0]]
447447
self.support_vectors_ = sp.csr_matrix((self.data, self.col, self.row))
448448
# if self._sparse == False:
449449
# self.support_vectors_ = self.support_vectors_.toarray(order = 'C')

0 commit comments

Comments
 (0)