t = torch.randn(1, 3, 1, 4) print(t.shape) # torch.Size([1, 3, 1, 4]) print(t.squeeze().shape) # torch.Size([3, 4]) — all 1s gone print(t.squeeze(0).shape) # torch.Size([3, 1, 4]) — only dim 0 print(t.squeeze(1).shape) # torch.Size([1, 3, 1, 4]) — dim 1 is size 3, unchanged