pdft.tasks.complete

Contents

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_transform and image_size alone.

  • observed (Array) – The image, of the basis’s image_size, or its channel planes, (C, H, W). Only the pixels under mask are read.

  • mask (Array) – Boolean, True where the pixel was observed: of the image’s size, shared by the planes, or of observed’s shape.

  • k (int) – Coefficients kept at each step, over all the planes together.

  • steps (int) – Solver iterations.

Returns:

Array – The reconstruction: equal to observed under the mask, real, in the precision the basis’s transforms return.

Return type:

Array

Notes

Traceable in the basis’s tensors, observed and mask; k and steps are 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’s rtol), 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.