L2

class colibri.recovery.terms.fidelity.L2[source]

Bases: Module

L2 fidelity

\[f(\mathbf{x}) = \frac{1}{2}||\forwardLinear(\mathbf{x}) - \mathbf{y}||^2_2\]
forward(x, y, H=None)[source]

Computes the L2 fidelity term.

Parameters:
  • x (torch.Tensor) – The image to be reconstructed.

  • y (torch.Tensor) – The measurement data to be reconstructed.

  • H (function, optional) – The forward model. Defaults to None.

Returns:

The L2 fidelity term.

Return type:

torch.Tensor

grad(x, y, H=None, transform=None)[source]

Compute the gradient of the L2 fidelity term.

\[\nabla f(\mathbf{x}) = \nabla \frac{1}{2}||\forwardLinear(\mathbf{x}) - \mathbf{y}||^2_2\]
Parameters:
  • x (torch.Tensor) – Input tensor.

  • y (torch.Tensor) – The measurement data to be reconstructed.

  • H (function) – Forward model.

Returns:

Gradient of the L1 fidelity term.

Return type:

torch.Tensor

Examples using L2:

Demo FISTA.

Demo FISTA.

Demo PnP.

Demo PnP.