Distance#

class deepinv.optim.Distance(d=None)[source]#

Bases: Potential

Distance \(\distance{x}{y}\).

This is the base class for a distance \(\distance{x}{y}\) between a variable \(x\) and an observation \(y\). Comes with methods to compute the distance gradient, proximal operator or convex conjugate with respect to the variable \(x\).

Warning

All variables have a batch dimension as first dimension.

Parameters:

d (callable) – distance function \(\distance{x}{y}\). Outputs a tensor of size B, the size of the batch. Default: None.

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.

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

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

Parameters:
Returns:

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