mrpro.utils.unsqueeze_right

mrpro.utils.unsqueeze_right(x: Tensor, n: int) Tensor[source]

Unsqueeze multiple times in the rightmost dimension.

Example

Tensor with shape (1, 2, 3) and n=2 would result in a tensor with shape (1, 2, 3, 1, 1).

Parameters:
  • x (Tensor) – Tensor to unsqueeze.

  • n (int) – Number of times to unsqueeze.

Returns:

Unsqueezed tensor (view).