IndicatorL2
- class deepinv.optim.IndicatorL2(radius=None)[source]
Bases:
DataFidelity
Indicator of \(\ell_2\) ball with radius \(r\).
The indicator function of the $ell_2$ ball with radius \(r\), denoted as iota_{mathcal{B}_2(y,r)(u)}, is defined as
\[\begin{split}\iota_{\mathcal{B}_2(y,r)}(u)= \left. \begin{cases} 0, & \text{if } \|u-y\|_2\leq r \\ +\infty & \text{else.} \end{cases} \right.\end{split}\]- Parameters:
radius (float) – radius of the ball. Default: None.
- d(u, y, radius=None)[source]
Computes the batched indicator of \(\ell_2\) ball with radius radius, i.e. \(\iota_{\mathcal{B}(y,r)}(u)\).
- Parameters:
u (torch.Tensor) – Variable \(u\) at which the indicator is computed. \(u\) is assumed to be of shape (B, …) where B is the batch size.
y (torch.Tensor) – Data \(y\) of the same dimension as \(u\).
radius (float) – radius of the \(\ell_2\) ball. If radius is None, the radius of the ball is set to self.radius. Default: None.
- Returns:
(torch.Tensor) indicator of \(\ell_2\) ball with radius radius. If the point is inside the ball, the output is 0, else it is 1e16.
- prox(x, y, physics, radius=None, stepsize=None, crit_conv=1e-05, max_iter=100)[source]
Proximal operator of the indicator of \(\ell_2\) ball with radius radius, i.e.
\[\operatorname{prox}_{\gamma \iota_{\mathcal{B}_2(y, r)}(A\cdot)}(x) = \underset{u}{\text{argmin}} \,\, \iota_{\mathcal{B}_2(y, r)}(Au)+\frac{1}{2}\|u-x\|_2^2\]Since no closed form is available for general measurement operators, we use a dual forward-backward algorithm, as suggested in Proximal Splitting Methods in Signal Processing.
- Parameters:
x (torch.Tensor) – Variable \(x\) at which the proximity operator is computed.
y (torch.Tensor) – Data \(y\) of the same dimension as \(\forw{x}\).
radius (torch.Tensor) – radius of the \(\ell_2\) ball.
stepsize (float) – step-size of the dual-forward-backward algorithm.
crit_conv (float) – convergence criterion of the dual-forward-backward algorithm.
max_iter (int) – maximum number of iterations of the dual-forward-backward algorithm.
gamma (float) – factor in front of the indicator function. Notice that this does not affect the proximity operator since the indicator is scale invariant. Default: None.
- Returns:
(torch.Tensor) projection on the \(\ell_2\) ball of radius radius and centered in y.
- prox_d(x, y, radius=None, gamma=None)[source]
Proximal operator of the indicator of \(\ell_2\) ball with radius radius, i.e.
\[\operatorname{prox}_{\iota_{\mathcal{B}_2(y,r)}}(x) = \operatorname{proj}_{\mathcal{B}_2(y, r)}(x)\]where \(\operatorname{proj}_{C}(x)\) denotes the projection on the closed convex set \(C\).
- Parameters:
x (torch.Tensor) – Variable \(x\) at which the proximity operator is computed.
y (torch.Tensor) – Data \(y\) of the same dimension as \(x\).
gamma (float) – step-size. Note that this parameter is not used in this function.
radius (float) – radius of the \(\ell_2\) ball.
- Returns:
(torch.Tensor) projection on the \(\ell_2\) ball of radius radius and centered in y.
Examples using IndicatorL2
:
Unfolded Chambolle-Pock for constrained image inpainting