mrpro.utils.unsqueeze_left

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

Unsqueze 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 to unsqueeze

  • n – number of times to unsqueeze

Return type:

unsqueezed tensor (view)