From: Sinacam Date: Sat, 6 Aug 2022 02:13:24 +0000 (+0800) Subject: ndarray.resize pads with zeros, np.resize doesn't X-Git-Tag: v245~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=188518186e1131d548eaa7c09a282f76610ef98c;p=liblinear ndarray.resize pads with zeros, np.resize doesn't --- 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))