spyrit.core.meas.Linear.forward

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

Applies linear transform to incoming images: \(y = Hx\).

This is equivalent to computing \(x \cdot H^T\). The input images must be unvectorized.

Args:

\(x\) (torch.tensor): Batch of images of shape \((*, h, w)\). * can have any number of dimensions, for instance (b, c) where b is the batch size and c the number of channels. h and w are the height and width of the images.

Shape:

\(x\): \((*, h, w)\) where * denotes the batch size and N the total number of pixels in the image.

Output: \((*, M)\) where * denotes any number of dimensions and M the number of measurements.

Example:
>>> H = torch.randn([400, 1600])
>>> meas_op = Linear(H)
>>> x = torch.randn([10, 40, 40])
>>> y = meas_op(x)
>>> print(y.shape)
torch.Size([10, 400])