pdft.tasks.complete#
- pdft.tasks.complete(basis, observed, mask, *, k, steps)[source]#
Reconstruct a real image from its pixels under
mask.- Parameters:
basis – Any basis: it is used through
forward_transform,inverse_transformandimage_sizealone.observed (Array) – The image, of the basis’s
image_size, or its channel planes,(C, H, W). Only the pixels undermaskare read.mask (Array) – Boolean,
Truewhere the pixel was observed: of the image’s size, shared by the planes, or ofobserved’s shape.k (int) – Coefficients kept at each step, over all the planes together.
steps (int) – Solver iterations.
- Returns:
Array – The reconstruction: equal to
observedunder the mask, real, in the precision the basis’s transforms return.- Return type:
Notes
Traceable in the basis’s tensors,
observedandmask;kandstepsare static. Each step is rematerialised in the backward pass, so a gradient holds one image per step, not the intermediates of every gate.The coefficients of a real image under a Fourier-like basis come in pairs of equal magnitude, and a cut between the two of a pair would be decided by rounding. Magnitudes within
sqrt(eps)of the cut count as tied and the tie is settled by position (topk_truncate’srtol), so the reconstruction and its gradient are the same, up to rounding, on a CPU and on a GPU and with either arithmetic of the applier.