📅  最后修改于: 2022-03-11 14:45:52.204000             🧑  作者: Mango
torch.transpose(input, dim0, dim1)
#input (Tensor) – the input tensor.
#dim0 (int) – the first dimension to be transposed
#dim1 (int) – the second dimension to be transposed
ex:-
>>> x = torch.randn(2, 3)
>>> x
#dimention 1
tensor([[ 1.0028, -0.9893, 0.5809], # dimension 2
[-0.1669, 0.7299, 0.4942]])
>>> torch.transpose(x, 0, 1)
tensor([[ 1.0028, -0.1669],
[-0.9893, 0.7299],
[ 0.5809, 0.4942]])