SmoothedTVPrior#

class deepinv.optim.SmoothedTVPrior(eps=2e-1, *args, **kwargs)[source]#

Bases: TVPrior

Smoothed total variation prior.

\[g(x) = \sum_i \sqrt{\|(Dx)_i\|_2^2 + \varepsilon^2}\]

A differentiable approximation of TVPrior, where the non-smooth \(\ell_2\) norm is replaced by a smoothed version parameterized by \(\varepsilon\). Since \(g\) is differentiable everywhere, its proximal operator has no closed form and is approximated with the inner gradient-descent solver inherited from Potential.

Parameters:

eps (float) – smoothing parameter \(\varepsilon > 0\). Default: 2e-1.

fn(x, *args, **kwargs)[source]#

Computes the regularizer

\[\reg{x} = \sum_i \sqrt{\|(Dx)_i\|_2^2 + \varepsilon^2}\]

where D is the finite differences linear operator, and the 2-norm is taken on the dimension of the differences.

Parameters:

x (torch.Tensor) – Variable \(x\) at which the prior is computed.

Returns:

(torch.Tensor) prior \(g(x)\).

Return type:

Tensor

grad(x, *args, **kwargs)[source]#

Computes the closed-form gradient of the smoothed TV prior at \(x\)

\[\nabla \reg{x} = D^\top \left( \frac{Dx}{\sqrt{\|Dx\|_2^2 + \varepsilon^2}} \right)\]
Parameters:

x (torch.Tensor) – Variable \(x\) at which the gradient is computed.

Returns:

(torch.Tensor) gradient \(\nabla_x g\), computed in \(x\).

prox(x, *args, gamma=0.1, stepsize_inter=None, max_iter_inter=200, tol_inter=1e-3, **kwargs)[source]#

Approximates the proximal operator using gradient descent.

Parameters:
  • x (torch.Tensor) – Variable \(x\) at which the proximity operator is computed.

  • gamma (float) – stepsize of the proximity operator.

  • stepsize_inter (float) – stepsize used for the internal gradient descent. By default, uses the one from the Liscphitz bound.

  • max_iter_inter (int) – maximal number of iterations for the internal gradient descent.

  • tol_inter (float) – internal gradient descent has converged when the L2 distance between two consecutive iterates is smaller than tol_inter.

Returns:

(torch.Tensor) proximity operator at \(x\).

Return type:

Tensor