StructuredRandom

class deepinv.physics.StructuredRandom(input_shape, output_shape, n_layers=1, transform_func=<function dst1>, transform_func_inv=<function dst1>, diagonals=None, device='cpu', rng: ~torch._C.Generator | None = None, **kwargs)[source]

Bases: LinearPhysics

Structured random linear operator model corresponding to the operator

\[A(x) = \prod_{i=1}^N (F D_i) x,\]

where \(F\) is a matrix representing a structured transform, \(D_i\) are diagonal matrices, and \(N\) refers to the number of layers. It is also possible to replace \(x\) with \(Fx\) as an additional 0.5 layer.

Parameters:
  • input_shape (tuple) – input shape. If (C, H, W), i.e., the input is a 2D signal with C channels, then zero-padding will be used for oversampling and cropping will be used for undersampling.

  • output_shape (tuple) – shape of outputs.

  • n_layers (float) – number of layers \(N\). If layers=N + 0.5, a first :math`F` transform is included, ie \(A(x)=|\prod_{i=1}^N (F D_i) F x|^2\). Default is 1.

  • transform_func (function) – structured transform function. Default is deepinv.physics.structured_random.dst1().

  • transform_func_inv (function) – structured inverse transform function. Default is deepinv.physics.structured_random.dst1().

  • diagonals (list) – list of diagonal matrices. If None, a random \({-1,+1}\) mask matrix will be used. Default is None.

  • device (str) – device of the physics. Default is ‘cpu’.

  • rng (torch.Generator) – Random number generator. Default is None.