ZeroDistance#

class deepinv.optim.ZeroDistance[source]#

Bases: Distance

Zero distance \(\distance{z}{y} = 0\).

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

Computes the distance \(\distance{x}{y}\).

Parameters:
Returns:

(torch.Tensor) distance \(\distance{x}{y}\) of size B with B the size of the batch.

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

Calculates the gradient of the potential term \(h\) at \(x\). By default, the gradient is computed using automatic differentiation.

Parameters:

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

Returns:

(torch.tensor) gradient \(\nabla_x h\), computed in \(x\).

prox(x, y, gamma=1.0, *args, **kwargs)[source]#

Calculates the proximity operator of \(h\) at \(x\). By default, the proximity operator is computed using internal 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 internal gradient descent

  • max_iter_inter (int) – maximal number of iterations for 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 \(\operatorname{prox}_{\gamma h}(x)\), computed in \(x\).