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 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)