Hi Sandeep!



 sandeep1:

How does dim dim in squeeze and unsqueze work?


torch.squeeze() removes those dimensions of a tensor that have
size = 1.  This is explained reasonably clearly in the documentation
for torch.squeeze.
Specifically, if you give squeeze() no dim argument, it removes all
size = 1 dimensions.  If you give squeeze() a value for dim, it
removes just that dimension, but only if it has size = 1.


x = torch.zeros(2, 1, 2, 1, 2)


This looks like a typo.  Based on the results you give below, I think
this should be x = torch.zeros(1, 2, 1, 2, 1, 2).
Best.
K. Frank