spyrit.core.meas.DynamicLinear.unvectorize
- DynamicLinear.unvectorize(input: tensor) tensor
Unflatten the measured dimensions.
This method first expands the last dimension into the measurement shape (
self.meas_shape), and then moves the expanded dimensions to their original positions as defined byself.meas_dims.- Input:
input (
torch.tensor): A tensor of shape (*, self.N) where * denotes any batch size.- Output:
torch.tensor: A tensor whose dimensions given byself.meas_dimshave shapeself.meas_shape.- See also:
For the opposite operation use
vectorize().- Example:
>>> import spyrit.core.meas as meas >>> matrix = torch.randn(10, 60) >>> meas_op = meas.Linear(matrix, meas_shape=(12, 5), meas_dims=(-1,-3)) >>> m = torch.randn(3, 7, 60) >>> print(meas_op.unvectorize(m).shape) torch.Size([3, 5, 7, 12])