shlogg · Early preview
Super Kai (Kazuya Ito) @superkai_kazuya

Understanding Torch Squeeze() In PyTorch

squeeze() removes 1D dimensions from tensors. Use torch.squeeze() or tensor.squeeze(). Specify dim to remove specific dimensions. Examples: `torch.squeeze(input=my_tensor)` and `my_tensor.squeeze(dim=(0, 3))`.

Buy Me a Coffee☕
*My post explains unsqueeze().
squeeze() can get the 0D or more D tensor of the zero or more elements whose zero or more dimensions are removed if the size is 1 from the 0D or more D tensor of zero or more elements as shown below:
*Memos:

squeeze() can be used with torch or a tensor.
The 1st argument(input) with torch or using a tensor(Required-Type:tensor of int, float, complex or bool).
The 2nd argument with torch or the 1st or more arguments with a tensor are dim(Optional-Type:int, tuple of int or list of int):
*Memos:

Each number must be unique. 
It can remove the speci...