From 94d11fe36ef3130449db71bf7ec27ca9abb6716a Mon Sep 17 00:00:00 2001 From: Thierry Moudiki Date: Thu, 10 Aug 2023 21:08:48 +0200 Subject: [PATCH] do version 0.9.0 Pt.2 --- teller/utils/numerical_gradient.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/teller/utils/numerical_gradient.py b/teller/utils/numerical_gradient.py index cd19469..c4b5ce5 100644 --- a/teller/utils/numerical_gradient.py +++ b/teller/utils/numerical_gradient.py @@ -38,7 +38,7 @@ def numerical_gradient(f, X, normalize=False, h=None, n_jobs=None, verbose=1): X[:, ix] = value_x # restore (!) - grad[:, ix] = (fx_plus - fx_minus) / double_h + grad[:, ix] = (np.asarray(fx_plus) - np.asarray(fx_minus)) / double_h pbar.update(ix) @@ -75,7 +75,7 @@ def numerical_gradient(f, X, normalize=False, h=None, n_jobs=None, verbose=1): X[:, ix] = value_x # restore (!) - grad[:, ix] = (fx_plus - fx_minus) / (2 * h) + grad[:, ix] = (np.asarray(fx_plus) - np.asarray(fx_minus)) / (2 * h) if verbose == 1: pbar.update(ix) @@ -107,7 +107,7 @@ def gradient_column(ix): X[:, ix] = value_x # restore (!) - grad[:, ix] = (fx_plus - fx_minus) / (2 * h) + grad[:, ix] = (np.asarray(fx_plus) - np.asarray(fx_minus)) / (2 * h) if verbose == 1: print("\n")