From 188518186e1131d548eaa7c09a282f76610ef98c Mon Sep 17 00:00:00 2001 From: Sinacam Date: Sat, 6 Aug 2022 10:13:24 +0800 Subject: [PATCH] ndarray.resize pads with zeros, np.resize doesn't --- python/liblinear/commonutil.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/liblinear/commonutil.py b/python/liblinear/commonutil.py index 6ec304b..91e0151 100644 --- a/python/liblinear/commonutil.py +++ b/python/liblinear/commonutil.py @@ -160,8 +160,8 @@ def csr_scale(x, scale_param): if not n == len(coef): print("WARNING: The dimension of scaling parameters and feature number do not match.", file=sys.stderr) - coef = np.resize(coef, n) - offset = np.resize(offset, n) + coef = coef.resize(n) + offset = offset.resize(n) # scaled_x = x * diag(coef) + ones(l, 1) * offset' offset = sparse.csr_matrix(offset.reshape(1, n)) -- 2.50.1