April 5, 2024, 10:04 a.m. | Super Kai (Kazuya Ito)

DEV Community dev.to

*My post explains permute() and movedim().


transpose(), adjoint(), mT or mH can transpose a 0D or more D tensor without losing data as shown below:



import torch

my_tensor = torch.tensor([[[0, 1, 2], [3, 4, 5]],
[[6, 7, 8], [9, 10, 11]],
[[12, 13, 14], [15, 16, 17]],
[[18, 19, 20], [21, 22, 23]]])
# The size is [4, 2, 3].
torch.transpose(my_tensor, 0, 0)
my_tensor.transpose(0, 0)
torch.transpose(my_tensor, 1, 1)
my_tensor.transpose(1, 1)
torch.transpose(my_tensor, 2, 2)
my_tensor.transpose(2, 2)
torch.transpose(my_tensor, …

data import pytorch reshape tensor torch view

Founding AI Engineer, Agents

@ Occam AI | New York

AI Engineer Intern, Agents

@ Occam AI | US

AI Research Scientist

@ Vara | Berlin, Germany and Remote

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne