StructuredRandomPhaseRetrieval#
- class deepinv.physics.StructuredRandomPhaseRetrieval(input_shape: tuple, output_shape: tuple, n_layers: int, transform='fft', diagonal_mode='uniform_phase', shared_weights=False, dtype=torch.complex64, device='cpu', **kwargs)[source]#
Bases:
PhaseRetrieval
Structured random phase retrieval model corresponding to the operator
\[A(x) = |\prod_{i=1}^N (F D_i) x|^2,\]where \(F\) is the Discrete Fourier Transform (DFT) matrix, and \(D_i\) are diagonal matrices with elements of unit norm and random phases, and \(N\) refers to the number of layers. It is also possible to replace \(x\) with \(Fx\) as an additional 0.5 layer.
For oversampling, we first pad the input signal with zeros to match the output shape and pass it to \(A(x)\). For undersampling, we first pass the signal in its original shape to \(A(x)\) and trim the output signal to match the output shape.
The phase of the diagonal elements of the matrices \(D_i\) are drawn from a uniform distribution in the interval \([0, 2\pi]\).
- Parameters:
input_shape (tuple) – shape (C, H, W) of inputs.
output_shape (tuple) – shape (C, H, W) of outputs.
n_layers (float) – number of layers \(N\). If
layers=N + 0.5
, a first \(F\) transform is included, i.e., \(A(x)=|\prod_{i=1}^N (F D_i) F x|^2\).transform (str) – structured transform to use. Default is ‘fft’.
diagonal_mode (str) – sampling distribution for the diagonal elements. Default is ‘uniform_phase’.
shared_weights (bool) – if True, the same diagonal matrix is used for all layers. Default is False.
dtype (torch.type) – Signals are processed in dtype. Default is torch.cfloat.
device (str) – Device for computation. Default is cpu.
- B_dagger(y)[source]#
Computes the linear pseudo-inverse of \(B\).
- Parameters:
y (torch.Tensor) – measurements.
- Returns:
(torch.Tensor) the reconstruction image \(x\).