PhaseRetrieval

class deepinv.physics.PhaseRetrieval(B: LinearPhysics, **kwargs)[source]

Bases: Physics

Phase Retrieval base class corresponding to the operator

\[\forw{x} = |Bx|^2.\]

The linear operator \(B\) is defined by a deepinv.physics.LinearPhysics object.

An existing operator can be loaded from a saved .pth file via self.load_state_dict(save_path), in a similar fashion to torch.nn.Module.

Parameters:

B (deepinv.physics.forward.LinearPhysics) – the linear forward operator.

A(x: Tensor, **kwargs) Tensor[source]

Applies the forward operator to the input x.

Note here the operation includes the modulus operation.

Parameters:

x (torch.Tensor) – signal/image.

A_dagger(y: Tensor, **kwargs) Tensor[source]

Computes an initial reconstruction for the image \(x\) from the measurements \(y\).

We use the spectral methods defined in deepinv.optim.phase_retrieval.spectral_methods to obtain an initial inverse.

Parameters:

y (torch.Tensor) – measurements.

Returns:

(torch.Tensor) an initial reconstruction for image \(x\).

A_vjp(x, v)[source]

Computes the product between a vector \(v\) and the Jacobian of the forward operator \(A\) at the input x, defined as:

\[A_{vjp}(x, v) = 2 \overline{B}^{\top} \text{diag}(Bx) v.\]
Parameters:
Returns:

(torch.Tensor) the VJP product between \(v\) and the Jacobian.

B_dagger(y)[source]

Computes the linear pseudo-inverse of \(B\).

Parameters:

y (torch.Tensor) – measurements.

Returns:

(torch.Tensor) the reconstruction image \(x\).

forward(x, **kwargs)[source]

Applies the phase retrieval measurement operator, i.e. \(y = \noise{|Bx|^2}\) (with noise \(N\) and/or sensor non-linearities).

Parameters:

x (torch.Tensor,list[torch.Tensor]) – signal/image

Returns:

(torch.Tensor) noisy measurements

Examples using PhaseRetrieval:

Random phase retrieval and reconstruction methods.

Random phase retrieval and reconstruction methods.