未验证 提交 af39c163 编写于 作者: D DrowFish19 提交者: GitHub

fix the strong Wolfe conditions for line search for minimize_lbfgs and minimize_bfgs APIs (#52033)

* fix the strong Wolfe conditions for line search

* pass the max_line_search_iters parameter into line search method (strong_wolfe)
上级 950b563b
...@@ -141,6 +141,7 @@ def minimize_bfgs( ...@@ -141,6 +141,7 @@ def minimize_bfgs(
f=objective_func, f=objective_func,
xk=xk, xk=xk,
pk=pk, pk=pk,
max_iters=max_line_search_iters,
initial_step_length=initial_step_length, initial_step_length=initial_step_length,
dtype=dtype, dtype=dtype,
) )
......
...@@ -212,6 +212,7 @@ def minimize_lbfgs( ...@@ -212,6 +212,7 @@ def minimize_lbfgs(
f=objective_func, f=objective_func,
xk=xk, xk=xk,
pk=pk, pk=pk,
max_iters=max_line_search_iters,
initial_step_length=initial_step_length, initial_step_length=initial_step_length,
dtype=dtype, dtype=dtype,
) )
......
...@@ -314,7 +314,7 @@ def strong_wolfe( ...@@ -314,7 +314,7 @@ def strong_wolfe(
paddle.assign(ls_func_calls + j, ls_func_calls) paddle.assign(ls_func_calls + j, ls_func_calls)
pred1 = ~done & ( pred1 = ~done & (
(phi_2 > phi_0 + c1 * a2 * derphi_0) | ((phi_2 >= phi_0) & (i > 1)) (phi_2 > phi_0 + c1 * a2 * derphi_0) | ((phi_2 >= phi_1) & (i > 1))
) )
paddle.assign(done | pred1, done) paddle.assign(done | pred1, done)
paddle.static.nn.cond(pred1, true_fn1, None) paddle.static.nn.cond(pred1, true_fn1, None)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册