Skip to content

Commit 0320c45

Browse files
committed
fix wrong timimg reports
1 parent f8dee3e commit 0320c45

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

econpizza/utilities/newton.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Newton heavy lifting functions and helpers
22
"""
33

4-
from grgrjax import jax_print
54
import jax
65
import time
76
import jax.numpy as jnp
@@ -80,6 +79,9 @@ def newton_for_jvp(jvp_func, jacobian, x_init, verbose, tol=1e-8, maxit=20, nste
8079
x = x_init[1:-1].flatten()
8180

8281
(x, _, f, dampening, cnt, fev, err_inner), _ = jax.lax.while_loop(jvp_while_cond, jvp_while_body, ((x, jnp.zeros_like(x), x, 0., 0, 0, 0), (jvp_func, jacobian, maxit, relaxation, nsteps, tol, factor, verbose)))
82+
# be sure that the while loop is done
83+
_ = x.block_until_ready()
84+
# document last result
8385
err = amax(f)
8486
ltime = time.time() - start_time
8587
callback_with_damp(cnt, err, fev=fev, err_inner=err_inner, dampening=dampening, ltime=ltime, verbose=verbose)

0 commit comments

Comments
 (0)