optim.ADMM#
- class bartorch.optim.ADMM#
Bases:
Alternating direction method of multipliers, looping
ADMMBlock.Solves \(\min_x \tfrac12 \| A x - y \|^2 + \sum_j g_j(G_j x - b_j)\), splitting each term at \(G_j x\); each x-update is a conjugate-gradient solve.
- Parameters:
regularizers (Regularizer or ImplicitPrior, or an iterable of them, default=None) – The terms \(g_j\), with any transform \(G_j\), including terms with auxiliary variables.
maxiter (int, default=30) – Budget of conjugate-gradient iterations over the whole run, not of outer iterations: the run stops once the inner iterations spent exceed it, as BART’s
admmdoes.rho (float, default=0.5) – Penalty parameter \(\rho\).
cg_maxiter (int, default=10) – Conjugate-gradient iterations per x-update.
hogwild (bool, default=False) – Double \(\rho\) after iteration 1, 3, 7, 15, … Excludes
dynamic_rho.cclambda (float, default=0.0) – Weight of an identity added to the normal operator.
biases (sequence of tensor, default=None) – The \(b_j\), one per term, each of its term’s
prox_shape().dynamic_rho (bool, default=False) – Multiply \(\rho\) by
tauwhen the primal residual exceedsmutimes the dual, divide it when the dual exceedsmutimes the primal; the scaled duals are rescaled to match.dynamic_tau (bool, default=False) – Set
taufrom the residuals, \(\sqrt{r / s}\) or its inverse, clipped totau_max(residual balancing, Wohlberg 2017).relative_norm (bool, default=False) – Compare the residuals each relative to its scaling.
fast (bool, default=False) – Skip the residuals, and with them the stopping test. Excludes
dynamic_rho.alpha (float, default=1.6) – Over-relaxation parameter.
mu (float, default=3.0) – Residual ratio beyond which
dynamic_rhorescales \(\rho\).tau_max (float, default=20.0) – Upper bound of
tau.abstol (float, default=0.0) – Absolute tolerance of the residual stopping test (Boyd et al. 2011).
reltol (float, default=0.0) – Relative tolerance of the residual stopping test. With both tolerances zero, as
italgo_configsets them, onlymaxiterends the run.cg_maxiter_first (int, default=None) – Conjugate-gradient iterations of the first x-update;
cg_maxiterwhen omitted.precond (LinearOperator, default=None) – Left preconditioner \(M\) from
A.ishapeto itself, positive definite (lsqr2_create’sprecond_op); BART’s reconstructions use none.
- Raises:
ValueError –
hogwildorfastwithdynamic_rho, or not one bias per term.
Notes
alpha,mu,tau_max, the tolerances, the biases andcg_maxiter_firsthave no counterpart initalgo_config, so BART’s own loop runs with their defaults.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.
- Parameters:
y (tensor) – Data of
A.oshape, or(batch, *A.oshape); a batch is solved one item at a time, each as its own run.A (LinearOperator) – Encoding operator. A BART-backed operator is applied inside the library; a Python-defined one is called back once per application.
x0 (tensor, default=None) – Starting image of
A.ishape, or one per batch item; zero when omitted.
- Returns:
Complex64 image of
A.ishape, withy’s batch axis in front.- Return type:
torch.Tensor
- Raises:
ValueError –
yrequires a gradient and a BART term has not been detached (detach()): its proximal operator has no backward pass.
Notes
The iterations are torch operations, so a solve is differentiated by unrolling. Step sizes and weights are fixed;
bartorch.optim’s blocks andUnrolledexpose them as parameters.