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

Software Engineering And Web Development With PyTorch Tensors

flipud() reverses elements in up/down direction, fliplr() reverses elements in left/right direction. Both used with torch or tensor, reversing elements as shown.

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

flipud() 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).


import torch
my_tensor = torch.tensor([2, 7, 4]) # 1D tensor
torch.flipud(input=my_tensor)
my_tensor.flipud()
# tensor([4, 7, 2])
my_tensor = torch.tensor([[2, 7, 4], [8, 3, 2]]) # 2D tensor
torch.flipud(input=my_tensor...