IndicatorL2Distance#

class deepinv.optim.IndicatorL2Distance(radius=None)[source]#

Bases: Distance

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)(x)}, is defined as

\[\begin{split}\iota_{\mathcal{B}_2(y,r)}(x)= \left. \begin{cases} 0, & \text{if } \|x-y\|_2\leq r \\ +\infty & \text{else.} \end{cases} \right.\end{split}\]
Parameters:

radius (float) – radius of the ball. Default: None.

fn(x, y, *args, radius=None, **kwargs)[source]#

Computes the batched indicator of \(\ell_2\) ball with radius radius, i.e. \(\iota_{\mathcal{B}(y,r)}(x)\).

Parameters:
  • x (torch.Tensor) – Variable \(x\) at which the indicator is computed. \(u\) is assumed to be of shape (B, …) where B is the batch size.

  • y (torch.Tensor) – Observation \(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, *args, radius=None, gamma=None, **kwargs)[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) – Observation \(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.