powered by
Transpose
torch_transpose(self, dim0, dim1)
(Tensor) the input tensor.
(int) the first dimension to be transposed
(int) the second dimension to be transposed
Returns a tensor that is a transposed version of input. The given dimensions dim0 and dim1 are swapped.
input
dim0
dim1
The resulting out tensor shares it's underlying storage with the input tensor, so changing the content of one would change the content of the other.
out
if (torch_is_installed()) { x = torch_randn(c(2, 3)) x torch_transpose(x, 1, 2) }
Run the code above in your browser using DataLab