mrpro.operators.OptimizerOp

class mrpro.operators.OptimizerOp[source]

Bases: Operator[Unpack[ArgumentType], VariableType]

Differentiable Optimization Operator.

Finds \(x^*=argmin_x f_p(x). The solution :math:`x^*\) will be differentiable with respect to some parameters \(p\) of the functional \(f\).

One of the building blocks of PINQI [ZIMM2024]

References

[ZIMM2024]

Zimmermann, Felix F., et al. (2024) PINQI. An End-to-End Physics-Informed Approach to Learned Quantitative MRI Reconstruction. IEEE TCI. https://doi.org/10.1109/TCI.2024.3388869

__init__(factory: Callable[[...], Callable[[...], tuple[Tensor]] | Operator[Any, tuple[Tensor]]], initializer: Callable[[Unpack[ArgumentType]], VariableType], optimize: Callable[[Callable, VariableType], VariableType] = default_lbfgs)[source]

Initialize a differentiable argmin solver.

Parameters:

Example

Solving \(\|q(x)-y\|^2 + \alpha*\|x-x_\mathrm{reg}\|^2\) with \(y\), \(\alpha\) and \(x_\mathrm{reg}\) parameters. The solution \(x^*\) should be differentiable with respect to these.

Use:

def factory(y, alpha, x_reg):
    return L2squared(y)@q+alpha*L2squared(x_reg)
def initializer(_y, _alpha, _xreg):
    return (x_reg,)
Returns:

The argmin x^*

__call__(*args: Unpack[Tin]) Tout[source]

Apply the forward operator.

For more information, see forward.

Note

Prefer using operator_instance(*parameters), i.e. using __call__ over using forward.

forward(*parameters: Unpack[ArgumentType]) VariableType[source]

Find the argmin.

Parameters:

parameters (Unpack[TypeVarTuple]) – Parameters of the argmin problem.

__add__(other: Operator[Unpack[Tin], Tout]) Operator[Unpack[Tin], Tout][source]
__add__(other: Tensor | complex) Operator[Unpack[Tin], tuple[Unpack[Tin]]]

Operator addition.

Returns lambda x: self(x) + other(x) if other is a operator, lambda x: self(x) + other*x if other is a tensor

__matmul__(other: Operator[Unpack[Tin2], tuple[Unpack[Tin]]] | Operator[Unpack[Tin2], tuple[Tensor, ...]]) Operator[Unpack[Tin2], Tout][source]

Operator composition.

Returns lambda x: self(other(x))

__mul__(other: Tensor | complex) Operator[Unpack[Tin], Tout][source]

Operator multiplication with tensor.

Returns lambda x: self(x*other)

__radd__(other: Tensor | complex) Operator[Unpack[Tin], tuple[Unpack[Tin]]][source]

Operator right addition.

Returns lambda x: other*x + self(x)

__rmul__(other: Tensor | complex) Operator[Unpack[Tin], Tout][source]

Operator multiplication with tensor.

Returns lambda x: other*self(x)