optim.ADMM#
- class bartorch.optim.ADMM#
Bases:
Alternating direction method of multipliers, looping
ADMMBlock.- Parameters:
regularizers (Regularizer or ImplicitPrior, or an iterable of them, default=None) – Terms with auxiliary variables – total generalized variation and the two infimal convolutions – walk the image and the fields behind it.
maxiter (int, default=30) – A budget on conjugate-gradient iterations across the whole run, not a count of outer steps:
admmbreaks whennr_invokes > maxiter. Thirty with ten inner iterations is about five outer steps.rho (float, default=0.5) – Penalty parameter; BART’s default is 0.5.
cg_maxiter (int, default=10) – Conjugate-gradient iterations per x-update; BART’s default is 10.
hogwild (bool, default=False) – BART’s
hogwildsetting, which doublesrhoafter ten steps, then twenty, then forty. Not combinable withdynamic_rho, which BART asserts against.cclambda (float, default=0.0) – Weight of an identity added to the normal operator.
biases (sequence of tensor, default=None) – The
b_joff_j(G_j x - b_j), one per term, each of its term’s transformed shape.dynamic_rho (bool, default=False) – Move
rhowith the residuals: up bytauwhen the primal residual leads, down when the dual does. The dual variables are rescaled to match, so the split stays where it was.dynamic_tau (bool, default=False) – Choose
taufrom the residuals too, assqrt(r / s)clipped to[1 / tau_max, tau_max]. Together withdynamic_rhoandrelative_normthis is the residual balancing of Wohlberg (2017).relative_norm (bool, default=False) – Compare the residuals to their scalings rather than to each other.
fast (bool, default=False) – Skip the residuals entirely, and with them the stopping test.
alpha (float, default=1.6) – Over-relaxation; BART’s default is 1.6.
mu (float, default=3.0) – How far the residuals must part before
dynamic_rhomovesrho.tau_max (float, default=20.0) – The clip on
tau.abstol (float, default=0.0) – Boyd’s absolute and relative tolerances, which stop the iteration when both residuals are inside them.
italgo_configsets both to zero, so only the iteration budget stops the run.reltol (float, default=0.0) – Boyd’s absolute and relative tolerances, which stop the iteration when both residuals are inside them.
italgo_configsets both to zero, so only the iteration budget stops the run.cg_maxiter_first (int, default=None) – A separate budget for the first step’s inner solve, where there is no warm start to build on; riesling’s, not BART’s.
precond (LinearOperator, default=None) – Left preconditioner,
lsqr2_create’sprecond_op: chained onto the normal operator and onto the adjoint, so the iteration seesM(A^H A + lambda) x = M A^H y. Must be positive definite – BART composes it without symmetrizing. BART’s own reconstructions pass none.
Notes
italgo_confighas no way to passalpha,mu,tau_max, the tolerances, the biases orcg_maxiter_first, so BART’s own loop cannot be given them.Examples
Several terms, each split off with its own transform:
>>> terms = [priors.TotalVariation((-1, -2), 0.005), priors.L1(0.001)] >>> x = optim.ADMM(terms, maxiter=30)(kspace, A)
- __call__()#
Solve for the image given data
yand encodingA.- Parameters:
y (torch.Tensor) – Data of
A.oshape, recorded for autograd when it requires a gradient.A (LinearOperator) – The encoding. A BART-backed operator is applied without leaving the library; a Python-defined one is called back once per application.
x0 (torch.Tensor, default=None) – Warm start of
A.ishape; without one the iteration starts at zero.
- Returns:
Complex64 solution of
A.ishape, withy’s batch in front. A batch is solved one item at a time, each as its own run.- Return type:
torch.Tensor