spyrit.core.meas.DynamicLinearSplit.forward

DynamicLinearSplit.forward(x: tensor) tensor[source]

Simulates the measurement of a motion picture \(y = P \cdot x(t)\).

The output \(y\) is computed as \(y = Px\), where \(P\) is the measurement matrix and \(x\) is a batch of images.

The matrix \(P\) contains only positive values and is obtained by splitting a measurement matrix \(H\) such that \(P\) has a shape of \((2M, N)\) and P[0::2, :] = H_{+} and P[1::2, :] = H_{-}, where \(H_{+} = \max(0,H)\) and \(H_{-} = \max(0,-H)\).

If you want to measure with the original matrix \(H\), use the method forward_H().

Args:

x: Batch of images of shape \((*, t, c, h, w)\) where * denotes any dimension (e.g. the batch size), \(t\) the number of frames, \(c\) the number of channels, and \(h\), \(w\) the height and width of the images.

Output:

\(y\): Linear measurements of the input images. It has shape \((*, c, 2M)\) where * denotes any number of dimensions, \(c\) the number of channels, and \(M\) the number of measurements.

Important

There must be as many images as there are measurements in the split linear operator, i.e. \(t = 2M\).

Shape:

\(x\): \((*, t, c, h, w)\)

\(P\) has a shape of \((2M, N)\) where \(M\) is the number of measurements as defined by the first dimension of \(H\) and \(N\) is the number of pixels in the image.

\(output\): \((*, c, 2M)\) or \((*, c, t)\)

Example:
>>> x = torch.rand([10, 800, 3, 40, 40])
>>> H = torch.rand([400, 1600])
>>> meas_op = DynamicLinearSplit(H)
>>> y = meas_op(x)
>>> print(y.shape)
torch.Size([10, 3, 800])