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

Understanding PyTorch's Flip Function

torch.flip()` reverses the order of a specified dimension in a tensor.

Buy Me a Coffee☕
*My post explains flipud().
flip() can get the 0D or more D tensor of reversed zero or more elements from the 0D or more D tensor of zero or more elements as shown below:
*Memos:

flip() 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 dims(Required-Type:int, tuple of int or list of int). *Each number must be unique.


import torch
my_tensor = torch.tensor(2) # 0D tensor
torch.flip(input=my_tensor, dims=(0,))...