mrpro.utils.unsqueeze_left

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

Unsqueeze multiple times in the leftmost dimension.

Example

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

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

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

Returns:

Unsqueezed tensor (view).