minimize(method=’cg’)¶
-
torchmin.cg.
_minimize_cg
(fun, x0, max_iter=None, gtol=1e-05, normp=inf, callback=None, disp=0, return_all=False)[source]¶ Minimize a scalar function of one or more variables using nonlinear conjugate gradient.
The algorithm is described in Nocedal & Wright (2006) chapter 5.2.
- Parameters
fun (callable) – Scalar objective function to minimize.
x0 (Tensor) – Initialization point.
max_iter (int) – Maximum number of iterations to perform. Defaults to
200 * x0.numel()
.gtol (float) – Termination tolerance on 1st-order optimality (gradient norm).
normp (float) – 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.