mrpro.utils.unsqueeze_tensors_at
- mrpro.utils.unsqueeze_tensors_at(*x, dim: int, ndim: int | None = None) tuple[Tensor, ...][source]
Unsqueeze tensors at a specific dimension to the same number of dimensions.
Example
Tensors with shapes
(1, 2, 3)and(1, 3)anddim=-2result in tensors with shapes(1, 2, 3)and(1, 1, 3), as the maximum number of input dimensions is 3.Tensors with shapes
(1, 2, 3)and(1, 3)anddim=1andndim=4result in tensors with shapes(1, 1, 2, 3)and(1, 1, 1, 3).