Unsqueeze multiple times at a specific dimension.
Example
Tensor with shape (1, 2, 3)
, dim=2
, and n=2
would result in a tensor with shape (1, 2, 1, 1, 3)
.
- Parameters:
x (Tensor
) – Tensor to unsqueeze.
dim (int
) – Dimension to unsqueeze. Negative values are allowed.
n (int
) – Number of times to unsqueeze.