minimize(method=’bfgs’)¶
-
torchmin.bfgs.
_minimize_bfgs
(fun, x0, lr=1.0, inv_hess=True, max_iter=None, line_search='strong-wolfe', gtol=1e-05, xtol=1e-09, normp=inf, callback=None, disp=0, return_all=False)[source]¶ Minimize a multivariate function with BFGS
- Parameters
fun (callable) – Scalar objective function to minimize.
x0 (Tensor) – Initialization point.
lr (float) – Step size for parameter updates. If using line search, this will be used as the initial step size for the search.
inv_hess (bool) – Whether to parameterize the inverse hessian vs. the hessian with BFGS.
max_iter (int, optional) – Maximum number of iterations to perform. Defaults to
200 * x0.numel()
.line_search (str) – Line search specifier. Currently the available options are {‘none’, ‘strong_wolfe’}.
gtol (float) – Termination tolerance on 1st-order optimality (gradient norm).
xtol (float) – Termination tolerance on function/parameter changes.
normp (Number or str) – The norm type to use for termination conditions. Can be any value supported by
torch.norm()
.callback (callable, optional) – Function to call after each iteration with the current parameter state, e.g.
callback(x)
.disp (int or bool) – Display (verbosity) level. Set to >0 to print status messages.
return_all (bool, optional) – Set to True to return a list of the best solution at each of the iterations.
- Returns
result – Result of the optimization routine.
- Return type
OptimizeResult